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
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.
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.
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
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.
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?