apt module is giving me some very strange behavior: sometimes it works, sometimes it says python-apt is not installed

140 views
Skip to first unread message

chris d

unread,
Apr 7, 2014, 3:42:20 PM4/7/14
to ansible...@googlegroups.com
hi everyone, 

i'm really digging ansible so far, but I keep running into this one strange issue. 

I have a couple different roles, and for now they all target the same host. In a common role, it ansible uses the apt module to install some apt packages like so:

- name: install common apt packages
  apt: pkg={{ item }} state=installed update_cache=yes
  with_items: apt_packages

This bit works well, all the packages are installed as I would expect.

Then in another role (which uses a different vars file, so the apt_packages variable is different), I have this:

- name: install application server apt packages
  sudo: yes
  apt: pkg={{ item }} state=installed 
  with_items: apt_packages
  notify: install libjpeg


Which fails with the following: 
failed: [host] => (item= <<some package names here>>) => {"failed": true, "item": "libmysqlclient-dev,libmysqlclient18,libjpeg8-dev,libfreetype6-dev,zlib1g-dev,libtiff4-dev"}                                                                                            
msg: Could not import python modules: apt, apt_pkg. Please install python-apt package.

Which is weird because..
a) The python-apt module is installed
b) I just used the ansible apt module in a previous role and it worked just fine
c) running the straight command like this:

 - name: install appserver apt packages
   sudo: yes
   command: apt-get install -y libjpeg-dev libfreetype6-dev zlib1g-dev libtiff4-dev libjpeg-dev libmysqlclient-dev 

works fine. But I'd like to use the ansible apt module in order to get the notify functionality to work so i don't have to rebuild libjpeg every time (ugly python/ubuntu/PIL bug workaround...don't ask :) )

If anyone sees anything that I'm doing wrong, let me know...I'm pretty new to ansible so it may be obvious. This is using ansible 1.4.3 and ubuntu 12.04 and python 2.7. 

Thanks!



James Cammarata

unread,
Apr 8, 2014, 11:35:41 AM4/8/14
to ansible...@googlegroups.com
Is there any chance you could try this with the 1.5.4 release, or with the most up to date devel branch to see if it's still an issue? If so, please open an issue on github so we can keep track of it.

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.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/740314b4-c0fd-4056-ace4-8559a96e3999%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages