Reputation: 1521
I upgraded my ansible to 2.4 and now I cannot manage my CentOS 5 hosts which are running python 2.4. How do I fix it?
http://docs.ansible.com/ansible/2.4/porting_guide_2.4.html says ansible 2.4 will not support any versions of python lower than 2.6
Upvotes: 2
Views: 2783
Reputation: 1
My experience so far has been that anisible works (gather facts) but that some modules (in particular yum / package) do not because yum uses python 2.4. I ended up using yum via command and shell modules (not pretty but works).
1) Before you can install python26 you need to fix the repos as CentOS5 is end of life: ( YumRepo Error: All mirror URLs are not using ftp, http[s] or file )
2) then you can install EPEL 5 and pthon26 ( https://www.ansible.com/blog/using-ansible-to-manage-rhel-5-yesterday-today-and-tomorrow )
3) then you can use the command module to use yum: ( CentOS 5. ansible_python_interpreter=/usr/bin/python26. Still cannot use yum: module )
many newer ansible modules don't work either due to missing python dependencies.
My intent is just to use Ansible in CentOS5 (or RH 5) to facilitate the upgrade to something newer and supported. ;)
Upvotes: 0
Reputation: 11
And what about python26-yum package? It is required to use yum module to install packages using Ansible.
Upvotes: 1
Reputation: 1521
After I upgraded to ansible 2.4 I was not able to manage hosts running python 2.6+. These were CentOS 5 hosts and this is how I fixed the problem.
First, I installed python26
from epel repo. After enabling epel repo, yum install python26
Then in my hosts file, for the CentOS 5 hosts, I added ansible_python_interpreter=/usr/bin/python26
as the python interpreter.
To specify the python interpreter in the hosts file individually, it will be something like
centos5-database ansible_python_interpreter=/usr/bin/python26
And for a group of hosts, it will be something like
[centos5-www:vars]
ansible_python_interpreter=/usr/bin/python26
Upvotes: 2