# apt module failing on Ubuntu 14.04 LTS

**URL:** <https://forum.ansible.com/t/apt-module-failing-on-ubuntu-14-04-lts/15047>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [April 18, 2014, 8:18pm UTC](https://forum.ansible.com/t/apt-module-failing-on-ubuntu-14-04-lts/15047 "2014-04-18T20:18:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Titus](https://avatars.discourse-cdn.com/v4/letter/m/82dd89/32.png) [@Mike\_Titus](https://forum.ansible.com/u/Mike_Titus)\
**Post date:** [April 18, 2014, 8:18pm UTC](https://forum.ansible.com/t/apt-module-failing-on-ubuntu-14-04-lts/15047/1 "2014-04-18T20:18:14Z")

</div>

Anisble 1.5.4 running from Ubuntu 13.10, “virgin” install of Ubuntu 14.04 LTS, the very first task of my playbook fails:

- name: apt-get update  
apt: update\_cache=yes

TASK: [common | apt-get update] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<1xx.xx.xx.xx\> ESTABLISH CONNECTION FOR USER: ubuntu  
\<1xx.xx.xx.xx\> REMOTE\_MODULE apt update\_cache=yes  
\<1xx.xx.xx.xx\> EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/home/miketitus/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘IdentityFile=creds/phantom-test’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=ubuntu’, ‘-o’, ‘ConnectTimeout=10’, ‘1xx.xx.xx.xx’, “/bin/sh -c ‘mkdir -p $HOME/.ansible/tmp/ansible-tmp-1397851850.37-160665359287307 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1397851850.37-160665359287307 && echo $HOME/.ansible/tmp/ansible-tmp-1397851850.37-160665359287307’”]  
\<1xx.xx.xx.xx\> PUT /tmp/tmprbQMHK TO /home/ubuntu/.ansible/tmp/ansible-tmp-1397851850.37-160665359287307/apt  
\<1xx.xx.xx.xx\> EXEC [‘ssh’, ‘-C’, ‘-tt’, ‘-vvv’, ‘-o’, ‘ControlMaster=auto’, ‘-o’, ‘ControlPersist=60s’, ‘-o’, ‘ControlPath=/home/miketitus/.ansible/cp/ansible-ssh-%h-%p-%r’, ‘-o’, ‘StrictHostKeyChecking=no’, ‘-o’, ‘Port=22’, ‘-o’, ‘IdentityFile=creds/phantom-test’, ‘-o’, ‘KbdInteractiveAuthentication=no’, ‘-o’, ‘PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey’, ‘-o’, ‘PasswordAuthentication=no’, ‘-o’, ‘User=ubuntu’, ‘-o’, ‘ConnectTimeout=10’, ‘1xx.xx.xx.xx’, ‘/bin/sh -c 'sudo -k && sudo -H -S -p “[sudo via ansible, key=jdrwkofumuslbxgkogxvwgixuhloymos] password: " -u root /bin/sh -c '”'“'echo SUDO-SUCCESS-jdrwkofumuslbxgkogxvwgixuhloymos; /usr/bin/python /home/ubuntu/.ansible/tmp/ansible-tmp-1397851850.37-160665359287307/apt; rm -rf /home/ubuntu/.ansible/tmp/ansible-tmp-1397851850.37-160665359287307/ \>/dev/null 2\>&1'”'"''’]  
failed: [1xx.xx.xx.xx] =\> {“failed”: true, “item”: “”}  
msg: Could not import python modules: apt, apt\_pkg. Please install python-apt package.

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [April 18, 2014, 8:47pm UTC](https://forum.ansible.com/t/apt-module-failing-on-ubuntu-14-04-lts/15047/2 "2014-04-18T20:47:01Z")

</div>

This issue has been fixed in the ‘devel’ branch, and will appear in 1.6

[https://github.com/ansible/ansible/pull/6518](https://github.com/ansible/ansible/pull/6518)

In the interim you may have to use the ‘raw’ module to install python-apt:

- name: install python-apt  
raw: apt-get update && apt-get install python-apt -y -q
