4

I have a virtual machine running centos 5.8 and I just installed python2.7 because I was having some issues with import simplejson as json. After installing python2.7 and running ansible roles I have the follwing error:

failed: [default] => (item=httpd,httpd-devel) => {"failed": true, "item": "httpd,httpd-devel", "parsed": false}
invalid output was: SUDO-SUCCESS-jexgalzfpawatwlwldjlitpbyuyelqew
Traceback (most recent call last):
  File "/home/vagrant/.ansible/tmp/ansible-1391226441.99-18554377653196/yum", line 26, in <module>
    import yum
ImportError: No module named yum

I searched all over the place for yum python module but I could not find it.

Can someone help me somehow?

tavi
  • 151

2 Answers2

1

I found an alternative solution to installing python2.7 yum module that fixes my initial error with import simplejosn as json. The solution was to include a shell provision before the ansible one with the following script that installs an older version of simplejson (compatible) with python2.4 (available on Centos 5.8):

#!/bin/sh
yum -y install wget
wget --no-check-certificate http://pypi.python.org/packages/source/s/simplejson/simplejson-2.0.9.tar.gz#md5=af5e67a39ca3408563411d357e6d5e47
tar xzvf simplejson-2.0.9.tar.gz
cd simplejson-2.0.9
sudo python setup.py install
tavi
  • 151
0

I had the same problem running ansible from a fresh virtualenv. Solution for me was the same as yours, only I used pip to put the simplejson module in the right place:

pip install simplejson==2.0.9
hobs
  • 111