I get this series of errors when trying to do a service install using the apt module with Ansible on an Ubuntu 14.x box.
On most of the other Ubuntu 14.x boxes it works fine.
There’s a handful that it doesn’t run on.
The relevant area of the playbook in tasks main yaml:
- name: Install the required packages for keyczar
apt: name={{ keyczar_name }} state=installed
The definition in vars main and debian yaml:
keyczar_name: python-keyczar
Prior to the run, the lock file /var/lib/dpkg/lock does not exist. After the failed run, it does exist. Manually removing it with rm and rerunning does nothing. The equivalent CLI being run is apt-get install python-keyczar -y which if run manually works. This concerns me because it is the first time I have seen a package get rejected when run under Ansible but works fine when installing manually. Makes no sense.
The specific error is:
fatal: [qaevt5.channel-corp.com]: FAILED! => {“cache_update_time”: 0, “cache_updated”: false, “changed”: false, “failed”: true, “msg”: “‘/usr/bin/ap
t-get -y -o "Dpkg::Options::=–force-confdef" -o "Dpkg::Options::=–force-confold" --simulate install ‘python-keyczar’’ failed: E: Could not ge
t lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)\nE: Unable to lock the administration directory (/var/lib/dpkg/), is another
process using it?\n”, “stderr”: “E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)\nE: Unable to lock the admi
nistration directory (/var/lib/dpkg/), is another process using it?\n”, “stdout”: “”, “stdout_lines”: }
fuser and lsof show no other processes holding the lock.
After the apt-get install python-keyczar -y is run manually, and the ansible run rerun, fine no problem. Package “ok”.
I am also cross-posting this to askubuntu.com.
The above lock file has other associated files post-manual run.
ls -l /var/cache/apt/archives/lock /var/lib/apt/lists/lock /var/lib/dpkg/lock
-rw-r----- 1 root root 0 Aug 5 2015 /var/cache/apt/archives/lock
-rw-r----- 1 root root 0 Mar 30 00:03 /var/lib/apt/lists/lock
-rw-r----- 1 root root 0 Mar 30 15:13 /var/lib/dpkg/lock
I am going to do the manual run on the half-dozen boxes where this is happening on. The other several dozen had no such issue.
Of course, until this is clarified, it has to be manually done which really defeats the purpose.