unarchive module fails

While using the module unarchive to upload a file.tar.gz from /tmp on my local machine I keep getting this error.
msg: Failed to find handler to unarchive. Make sure the required command to extract the file is installed.

Here are the logs I’m gathering on my localhost machine.

<host2.example.com> REMOTE_MODULE setup
2015-08-03 19:10:43,508 p=27364 u=andy | ok: [host2.example.com]
2015-08-03 19:10:43,509 p=27364 u=andy | TASK: [upload owasp ruleset and unpack] ***************************************
2015-08-03 19:10:59,984 p=27364 u=andy | failed: [host2.example.com] => {“failed”: true}
2015-08-03 19:10:59,984 p=27364 u=andy | msg: Failed to find handler to unarchive. Make sure the required command to extract the file is installed.
2015-08-03 19:10:59,984 p=27364 u=andy | FATAL: all hosts have already failed – aborting
2015-08-03 19:10:59,984 p=27364 u=andy | PLAY RECAP ********************************************************************
2015-08-03 19:10:59,984 p=27364 u=andy | to retry, use: --limit @/home/abrittingham/ksm_test.retry

2015-08-03 19:10:59,985 p=27364 u=andy | host2.example.com : ok=1 changed=0 unreachable=0 failed=1

On localhost:
ansible 1.9.2
configured module search path = None
Python 2.7.6

On the target:
This is from the last attempt when i changed .tar.gz to .tgz, with the same result.

Here is the log entry from /var/log/messages

Aug 3 19:10:59 host2 ansible-: Invoked with src=/home/andy/.ansible/tmp/ansible-tmp-1438643443.51-164965375926453/source directory_mode=None force=None remote_src=None dest=/etc/httpd/crs/ selevel=None seuser=None serole=None setype=None group=root creates=owasp-modsecurity-crs delimiter=None original_basename=owasp-modsecurity-crs.tgz mode=None follow=False owner=root regexp=None copy=True backup=None content=NOT_LOGGING_PARAMETER

python-2.7.5-18.el7_1.1.x86_64
for x in tar gzip bzip2 unzip; do echo $x; rpm -qa $x; done
tar
tar-1.26-29.el7.x86_64
gzip
gzip-1.5-7.el7.x86_64
bzip2
bzip2-1.0.6-12.el7.x86_64
unzip
unzip-6.0-15.el7.x86_64

This is my entire test playbook. This is just the snippet of a larger playbook, but it should work for testing.

This error is limited to my Ubuntu 14.04 control box. The same playbooks run without error with Ansible 1.9.2 on Fedora 21 and Ansible 1.9.2 on OSX

The error message you are receiving man’s that ansible is unable to find the program needed to uncompress and unarchive on the remote machine. I’d have to look but I believe for tar.gz files, ansible is looking for gtar and then falling back to tar. The reason is that it needs a tar that supports grip compression. Check what tar you have available on that system.

If there isn’t an obvious problem with tar, I can lookup the exact code to see what other incompatibilities might lead us to this error message.

-Toshio

I have these versions installed on my servers.

tar-1.26-29.el7.x86_64
gzip-1.5-7.el7.x86_64
bzip2-1.0.6-12.el7.x86_64
unzip-6.0-15.el7.x86_64

This is a new problem since I upgraded to ansible 1.9.2 on 14.04. I can run the same playbook on ansible on my mac or fedora 21 with no problems.

Andy

I'm facing similar issue using centos 6.8.

Archive is a simple tar archive without any compression.

However issue only appears when using Packer and its ansible post process provisioner.

When I disable this post process to get only VM and run ansible playbook myself locally `ansible-playbook -i "localhost," main.yml" no problem with unarchive.

Sound strange.

I'm using last ansible version from `pip install`.

I will try to define difference between how Packer run ansible it may give us some clues

Sorry, I’ve been at a conference and a few days of vacation. I’ll look into this today. What’s your source os and destination os?

-Toshio

I was unable to reproduce. I've tried the following on an ubuntu14 VM:

sudo apt-get remove ansible
pip install --user ansible
export PATH=$PATH:~/.local/bin/
ansible-playbook -i 'rhel7,' unarchive.yml -K

SUDO password:

PLAY [rhel7] ******************************************************************

GATHERING FACTS ***************************************************************
ok: [rhel7]

TASK: [upload owasp ruleset and unpack] ***************************************
changed: [rhel7]

PLAY RECAP ********************************************************************
rhel7 : ok=2 changed=1 unreachable=0 failed=0

My playbook is modeled after yours:

$ cat unarchive.yml

Thanks, that would be helpful. I'm not familiar with packer but
understand it is a tool to aid in creating containers and vm images.
I could see potential issues if packer is using its own version of tar
or a version of tar that we haven't tested with. But like I say, I
don't know the packer tools and environment so I don't know.

At the moment the unarchive module relies on a tar command that takes
command line switches to uncompress the tarball. Someone could submit
a patch to pipe through gzip/bzip2/xz first, and then into tar but it
hasn't been a priority for us as it has been working fine this way so
far.

Let us know what you find!

-Toshio

I have found same problem on CentOS, and I am using Unarchive module for my .tar.gz files which are downloaded using curl, it fails me sometimes. Have this one been solved?

Thanks,
Catie