Getting Ansible to use /usr/bin/python2.4 on RHEL4

I'm demoing Ansible to our sysadmin group, it looks highly promising.

Is there a well-defined way to get Ansible to attempt using /usr/bin/
python2.4 instead of /usr/bin/python?

We have a bunch of legacy RHEL4 boxes that we're trying to migrate
away from. Ansible would help in this process. Unfortunately the
scripts that Ansible creates in ~uxadmin/.ansible/tmp/*/command
require Python 2.4. /usr/bin/python is Python 2.3 on these boxes, and
we can't change it because software on the system depends on it, and
changing the version of system Python on an RHEL box is not
recommended as the package manager and other things use it. It could
probably be done, but it would have to go through lots of red tape.

I installed Python 2.4 in parallel to system python, using the RPMs
provided at python.org. It lives in /usr/bin/python2.4.

Looks like the scripts call /usr/bin/python by default. Any easily
defined way of telling it to look for /usr/bin/ansible-python?

Hacking the code is an option, I just don't want to duplicate anyone
else's work, or hack in ignorance of existing features.

Hi Matthew,

I'm demoing Ansible to our sysadmin group, it looks highly promising.

Is there a well-defined way to get Ansible to attempt using /usr/bin/
python2.4 instead of /usr/bin/python?

Yes, but you'll need the 0.5 development branch (due for release next week or so)

In either the playbook or the host file, you can set the variable ansible_python_interpreter to whatever you like.

This variable is used to mutate the first line of the modules before they are transferred.

Thanks much, that’s exactly what I expected would exist. I built RPMs from the devel branch in Git, and I don’t need this feature to operate until several weeks for now, so that’s plenty of time to work something out.

Excellent work. I’ve always thought that this kind of system could exist, but didn’t have the time or skills to make it happen.