Tuesday, September 22, 2015

Ansible installation on RedHat RHEL server with RPM packages

Ansible is a great tool for DevOps automation. At AdroitLogic, we recently initiated a drive to create Ansible based installation scripts for all of our enterprise product versions. Now an UltraESB cluster can be setup in a matter of minutes by configuring the inventory for the different components that makes up the system. A post on this will come shortly!

However, today we addressed the issue of installing Ansible on a RHEL machine without Internet access. This is a requirement for one of our customers. Unfortunately the Ansible installation instructions does not include steps on how to install the product with raw RPMs on a hardened system without Internet access.

1. Install the YUM download plugin

[root@emw01 ~]# yum install yum-plugin-downloadonly

2. Make a directory to "capture" the packages

[root@emw01 ~]# mkdir /tmp/ansible


3. Proceed with YUM install with following options

[root@emw01 ~]# yum install --downloadonly --downloaddir=/tmp/ansible/ ansible

4. The above step will download all of the required libraries and components to the directory /tmp/ansible. You can now copy these files onto your target system, and install each of the packages as listed below. Since some of the components may depend on others, you may need to tweak the order of components if you are installing a different version of Ansible on a RHEL version other than 6.6

rpm -ivh libyaml-0.1.3-4.el6_6.x86_64.rpm
rpm -ivh PyYAML-3.10-3.1.el6.x86_64.rpm
rpm -ivh python-babel-0.9.4-5.1.el6.noarch.rpm
rpm -ivh python-crypto-2.0.1-22.el6.x86_64.rpm
rpm -ivh python-crypto2.6-2.6.1-2.el6.x86_64.rpm
rpm -ivh python-pyasn1-0.0.12a-1.el6.noarch.rpm
rpm -ivh python-paramiko-1.7.5-2.1.el6.noarch.rpm
rpm -ivh python-setuptools-0.6.10-3.el6.noarch.rpm
rpm -ivh python-simplejson-2.0.9-3.1.el6.x86_64.rpm
rpm -ivh python-jinja2-2.2.1-2.el6_5.x86_64.rpm
rpm -ivh python-httplib2-0.7.7-1.el6.noarch.rpm
rpm -ivh python-keyczar-0.71c-1.el6.noarch.rpm
rpm -ivh ansible-1.9.2-1.el6.noarch.rpm

6 comments:

Vivek said...

Hi Asankha,

The list of rpms which you have mentioned in Step 4, are the depended rpms for ansible rpms.

Usually the following rpms are available as part of RHEL 6 DVD.

python-babel-0.9.4-5.1.el6.noarch.rpm
python-crypto-2.0.1-22.el6.x86_64.rpm
python-crypto2.6-2.6.1-2.el6.x86_64.rpm
python-pyasn1-0.0.12a-1.el6.noarch.rpm
python-paramiko-1.7.5-2.1.el6.noarch.rpm
python-setuptools-0.6.10-3.el6.noarch.rpm
python-simplejson-2.0.9-3.1.el6.x86_64.rpm

But could you please give me a pointer where can I find the following rpms?, As It doesn't come by default in RHEL6.x DVD.

libyaml-0.1.3-4.el6_6.x86_64.rpm
PyYAML-3.10-3.1.el6.x86_64.rpm
python-jinja2-2.2.1-2.el6_5.x86_64.rpm
python-httplib2-0.7.7-1.el6.noarch.rpm
python-keyczar-0.71c-1.el6.noarch.rpm
ansible-1.9.2-1.el6.noarch.rpm

Thanks & Regards,
Vivek Kumar

Vivek said...

Hi Asankha,

With respect to the following Blog https://esbmagic.blogspot.sg/2015/09/ansible-installation-on-redhat-rhel.html
How to get the following rpms mentioned in Step 4 of your blog?

1) libyaml-0.1.3-4.el6_6.x86_64.rpm
2) PyYAML-3.10-3.1.el6.x86_64.rpm
3) python-jinja2-2.2.1-2.el6_5.x86_64.rpm
4) python-httplib2-0.7.7-1.el6.noarch.rpm
5) python-keyczar-0.71c-1.el6.noarch.rpm
6) ansible-1.9.2-1.el6.noarch.rpm

Usually the other depended rpms which you have listed in Step 4 are available in RHEL6.x DVD installer.

Thanks & Regards,
Vivek kumar

Asankha Perera said...

Hi Vivek

Perform step #3 on a machine with the same target OS and with internet connectivity. Once the RPMs are downloaded into that, manually copy them to your target system (without internet access) and install the RPMs in the required order.

cheers
asankha

AdaJanks said...

Hi Asanshka,

I'm confused on the command: yum install --downloadonly --downloaddir=/tmp/ansible/ ansible

I don't see a package to install? I see the flag for downloadonly and to put it in /tmp/ansible but how does it know what package to fetch and put in there? Also, any idea where I can documentation to put this on RHEL5? I am trying to get this put in a environment without internet connectivity.

Thanks ahead!

Adam

Asankha Perera said...

Adam

I did this sometime back, so I do not remember all the details anymore.. As I see, the package is "ansible" in the command, and you are expected to perform Steps 1, 2, 3 on a machine with Internet access, for it to download the RPMs.

Then you manually copy these collected RPMs into the target system without internet access, and install the RPMs manually

cheers
asankha

AdaJanks said...

Gotchya. I overlooked the second ansible which specified the package. I do appreciate you taking a trip back in time just for me. Have a good one!

Respectfully,

Adam