Ansible hangs when using the apt module

Hi list,

I’m trying to install a couple of apt packages on Ubuntu 14.04, but Ansible just seems to hang indefinitely when it gets to this task:

  • name: Install needed packages for building BTRFS driver
    apt: name={{ item }}
    with_items:
  • uuid-dev
  • libattr1-dev
  • zlib1g-dev
  • libacl1-dev
  • e2fslibs-dev
  • libblkid-dev
  • liblzo2-dev
  • asciidoc
  • xmlto

I have a couple of questions regarding this:

  1. Is there a way to output the current command being executed by Ansible (in this case, the apt-get call)?

  2. What’s the difference between the “pkg” argument and name for the “apt” module?

  3. Does anyone have any idea why this hangs? Any possible solutions?

I’m using the -vvvv flag, but it doesn’t show any useful information to debug this problem.

Thanks in advance,

– Marcelo

1) you can use -vvvv to see the actual commands ansible runs (not the
apt get but the apt.py module), you can use the env var
ANSIBLE_KEEP_REMOTE_FILES=1 to keep the remote script and debug it
yourself.

2) none, one is an alias to the other

3) several possibilities, solutions depends on the problem
- its not hanging, just taking a long time (possible if the system is
having a hard time downloading the packages)
- its hanging, which can be caused by a bad package
- a package that requires input even though its in batch mode (use
debconf in this case, normally happens with licenses (oracle-java)
- your apt-cache is out of date and it keeps trying to download from
the wrong place

most of these you can figure out by running apt manually.