Problem with yum module running ansible-playbook

3,323 views
Skip to first unread message

James Nguyễn

unread,
Feb 13, 2013, 5:39:00 PM2/13/13
to ansible...@googlegroups.com
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 <module>
    import yum
ImportError: No module named yum
  

FATAL: all hosts have already failed -- aborting

Michael DeHaan

unread,
Feb 13, 2013, 5:57:19 PM2/13/13
to ansible...@googlegroups.com
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 :)
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

James Nguyễn

unread,
Feb 13, 2013, 6:24:39 PM2/13/13
to ansible...@googlegroups.com
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.

Michael DeHaan

unread,
Feb 13, 2013, 7:37:02 PM2/13/13
to ansible...@googlegroups.com
Absolutely not the suggested option.

install simplejson from EPEL.

Cynthia Hertzer

unread,
Aug 28, 2014, 1:52:56 PM8/28/14
to ansible...@googlegroups.com


On Wednesday, February 13, 2013 2:39:00 PM UTC-8, James Nguyễn wrote:
Has anyone come across this error below?

<stuff deleted>

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

    import yum
ImportError: No module named yum

Thanks!
Cynthia

Michael DeHaan

unread,
Aug 29, 2014, 8:01:01 AM8/29/14
to ansible...@googlegroups.com
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!


--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages