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> 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> REMOTE_MODULE yum pkg=syslog-ng state=absent CHECKMODE=True
<ui2.sm1.kernelfire.com> PUT /tmp/tmpysRmxm TO /root/.ansible/tmp/ansible-1360794943.18-266603927169694/yum
<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] => (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
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
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.
Absolutely not the suggested option.
install simplejson from EPEL.
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
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!