# Problem with yum module running ansible-playbook

**URL:** <https://forum.ansible.com/t/problem-with-yum-module-running-ansible-playbook/12351>\
**Category:** Ansible Project\
**Created:** [February 13, 2013, 10:39pm UTC](https://forum.ansible.com/t/problem-with-yum-module-running-ansible-playbook/12351 "2013-02-13T22:39:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Nguyen](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@James\_Nguyen](https://forum.ansible.com/u/James_Nguyen)\
**Post date:** [February 13, 2013, 10:39pm UTC](https://forum.ansible.com/t/problem-with-yum-module-running-ansible-playbook/12351/1 "2013-02-13T22:39:00Z")

</div>

Has anyone come across this error below? I’m trying to run ansible-playbook on CentOS5. I’ve already setup my PATHs and everything for python2.6 and the rest of the playbook runs through until I get to yum management.

TASK: [yum pkg= state=absent] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<[ui2.sm1.kernelfire.com](http://ui2.sm1.kernelfire.com)\> EXEC [‘/bin/sh’, ‘-c’, ‘mkdir -p $HOME/.ansible/tmp/ansible-1360794943.18-266603927169694 && echo $HOME/.ansible/tmp/ansible-1360794943.18-266603927169694’]  
\<[ui2.sm1.kernelfire.com](http://ui2.sm1.kernelfire.com)\> REMOTE\_MODULE yum pkg=syslog-ng state=absent CHECKMODE=True  
\<[ui2.sm1.kernelfire.com](http://ui2.sm1.kernelfire.com)\> PUT /tmp/tmpysRmxm TO /root/.ansible/tmp/ansible-1360794943.18-266603927169694/yum  
\<[ui2.sm1.kernelfire.com](http://ui2.sm1.kernelfire.com)\> EXEC [‘/bin/sh’, ‘-c’, ’ /usr/bin/python2.6 -tt /root/.ansible/tmp/ansible-1360794943.18-266603927169694/yum; rm -rf /root/.ansible/tmp/ansible-1360794943.18-266603927169694/ \>/dev/null 2\>&1’]  
failed: [[ui2.sm1.kernelfire.com](http://ui2.sm1.kernelfire.com)] =\> (item=syslog-ng) =\> {“failed”: true, “item”: “syslog-ng”, “parsed”: false}  
invalid output was: Traceback (most recent call last):  
File “/root/.ansible/tmp/ansible-1360794943.18-266603927169694/yum”, line 26, in   
import yum  
ImportError: No module named yum

FATAL: all hosts have already failed – aborting

---

<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:** [February 13, 2013, 10:57pm UTC](https://forum.ansible.com/t/problem-with-yum-module-running-ansible-playbook/12351/2 "2013-02-13T22:57:19Z")

</div>

Sounds like you have ansible\_python\_interpreter set to use a non OS  
standard python, and thus, it doesn't have yum.

Solution: don't do that 🙂

---

<div class="post-metadata">

**Author:** ![James\_Nguyen](https://avatars.discourse-cdn.com/v4/letter/j/48db29/32.png) [@James\_Nguyen](https://forum.ansible.com/u/James_Nguyen)\
**Post date:** [February 13, 2013, 11:24pm UTC](https://forum.ansible.com/t/problem-with-yum-module-running-ansible-playbook/12351/3 "2013-02-13T23:24:39Z")

</div>

I’ve tried digging through past post about running ansible from CentOS5, and I thought this was the suggested solution to get things to work.

Did I miss a thread suggesting otherwise? One of my goals was to run an ansible pull model so that I can run a cron job that would rerun ansible at a set interval. The other goal was to bootstrap a node after a cobbler provision so they ansible configures the rest of the node. We’re still 90% CentOS5 so I can’t just move to CentOS6 without a lot of regression testing.

---

<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:** [February 14, 2013, 12:37am UTC](https://forum.ansible.com/t/problem-with-yum-module-running-ansible-playbook/12351/4 "2013-02-14T00:37:02Z")

</div>

Absolutely not the suggested option.

install simplejson from EPEL.

---

<div class="post-metadata">

**Author:** ![Cynthia\_Hertzer](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@Cynthia\_Hertzer](https://forum.ansible.com/u/Cynthia_Hertzer)\
**Post date:** [August 28, 2014, 5:52pm UTC](https://forum.ansible.com/t/problem-with-yum-module-running-ansible-playbook/12351/5 "2014-08-28T17:52:56Z")

</div>

I used to be able to use vagrant + ansible to provision EC2 instances and run yum installs from my laptop (OSX 10.8.5), but after converting my scripts to use the ansible EC2 module, yum fails (ImportError shown below). I suspect that installing boto introduced some incompatibility on my Mac. I’m inexperienced with Python and would welcome any suggestions. At this point I’m going to try setting up a CentOS EC2 instance as my ansible box to workaround this problem.

Environment  
OSX 10.8.5  
Python 2.7.2 (Xcode… default in /usr/bin/python … definitely the one ansible references, it’s my only Python)  
ansible (1.7.1)  
boto (2.32.1)  
botocore (0.57.0)  
simplejson (2.0.9) (tried a \>v3 simplejson but no joy)

TASK: [common | Yum update] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
failed: [localhost] =\> {“failed”: true, “parsed”: false}  
invalid output was: Traceback (most recent call last):  
File “/Users/chertzer/.ansible/tmp/ansible-tmp-1409246926.89-9783608709566/yum”, line 27, in   
import yum  
ImportError: No module named yum

Thanks!  
Cynthia

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 29, 2014, 12:00pm UTC](https://forum.ansible.com/t/problem-with-yum-module-running-ansible-playbook/12351/6 "2014-08-29T12:00:57Z")

</div>

This won’t have anything to do with your ec2 module.

I suspect you are accidentally doing a local action on your Mac, or you have ansible\_python\_interpreter on your remotes pointed to a python that is not the system python, as yum will be installed in the system python.

Let me know if you need more info.

Thanks!
