Installing Ansible 2.3 on RHEL5/CentOS5 Step-by-Step

One of the things Ansible has issues with is CentOS5 or RHEL5. This is due to the fact that on such systems, python version is 2.4 by default. Of course, you can’t uninstall it as it will break the entire system.

Now, as this is 2017, why would I ever want to install Ansible on such old OS. The answer: ansible-pull.

This is not a new technology (ansible-pull I mean) as it’s been around since 2013 (when it all started with Ansible). Sounds great to maintain server configurations just like puppet or chef but in a much easier way. The thing here is, between Ansible 1.x and 2.x things change a LOT.

We needed to be able to execute ansible-pull on systems with RHEL5, 6 and 7. So 6 and 7 is pretty straightforward, as you can just go ahead and installĀ using:

yum install ansible 

but this is not the case with RHEL5.

So, in order to install everything, I had to install python2.6 in parallel with python2.4 as well as install pip and other python tools using the env variables of 2.6 version. So, how I did it? Here’s a quick way:

We install the EPEL repo:

yum -y install epel-release

Then install some requirements such as python v2.6, the devel libraries, and gcc for compiling a bunch of stuff:

yum -y install gcc rpm-build make asciidoc git python-setuptools python2-devel python26 python26-devel

In order to use python2.6 in parallel with 2.4, we just do a symlink:

ln -sf /usr/bin/python26 /usr/local/bin/python

Then we install pip for python2.6 as well as some of the tools needed by Ansible as per it’s documentation:


curl -k https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
pip install PyYAML Jinja2 httplib2 six

Finally, we clone the repo and install the binaries:


git clone git://github.com/ansible/ansible.git --recursive /opt/ansible/
cd /opt/ansible/
source ./hacking/env-setup

Then do a little test:

ansible-on-centos5

Note you will need to source the environment every time you logout and runĀ ansible or it will not find it (this can be easily done from the .bash_profile file).

Recent Posts

Recent Comments

    Meta

    tomas Written by: