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

**URL:** <https://forum.ansible.com/t/getting-ansible-to-use-usr-bin-python2-4-on-rhel4/11628>\
**Category:** Ansible Project\
**Tags:** rhel\
**Created:** [June 28, 2012, 4:06pm UTC](https://forum.ansible.com/t/getting-ansible-to-use-usr-bin-python2-4-on-rhel4/11628 "2012-06-28T16:06:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthew\_Probst](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@Matthew\_Probst](https://forum.ansible.com/u/Matthew_Probst)\
**Post date:** [June 28, 2012, 4:06pm UTC](https://forum.ansible.com/t/getting-ansible-to-use-usr-bin-python2-4-on-rhel4/11628/1 "2012-06-28T16:06:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jeroen\_Hoekx](https://avatars.discourse-cdn.com/v4/letter/j/ba9def/32.png) [@Jeroen\_Hoekx](https://forum.ansible.com/u/Jeroen_Hoekx)\
**Post date:** [June 28, 2012, 4:10pm UTC](https://forum.ansible.com/t/getting-ansible-to-use-usr-bin-python2-4-on-rhel4/11628/2 "2012-06-28T16:10:39Z")

</div>

Hi Matthew,

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [June 28, 2012, 4:11pm UTC](https://forum.ansible.com/t/getting-ansible-to-use-usr-bin-python2-4-on-rhel4/11628/3 "2012-06-28T16:11:23Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![Matthew\_Probst](https://avatars.discourse-cdn.com/v4/letter/m/71e660/32.png) [@Matthew\_Probst](https://forum.ansible.com/u/Matthew_Probst)\
**Post date:** [June 28, 2012, 4:17pm UTC](https://forum.ansible.com/t/getting-ansible-to-use-usr-bin-python2-4-on-rhel4/11628/4 "2012-06-28T16:17:55Z")

</div>

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.
