# unarchive module fails

**URL:** <https://forum.ansible.com/t/unarchive-module-fails/18930>\
**Category:** Ansible Project\
**Created:** [August 3, 2015, 11:48pm UTC](https://forum.ansible.com/t/unarchive-module-fails/18930 "2015-08-03T23:48:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andy\_Brittingham](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@Andy\_Brittingham](https://forum.ansible.com/u/Andy_Brittingham)\
**Post date:** [August 3, 2015, 11:48pm UTC](https://forum.ansible.com/t/unarchive-module-fails/18930/1 "2015-08-03T23:48:08Z")

</div>

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](http://host2.example.com)\> REMOTE\_MODULE setup  
2015-08-03 19:10:43,508 p=27364 u=andy | ok: [[host2.example.com](http://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](http://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](http://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.

---

<div class="post-metadata">

**Author:** ![Andy\_Brittingham](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@Andy\_Brittingham](https://forum.ansible.com/u/Andy_Brittingham)\
**Post date:** [August 4, 2015, 4:46pm UTC](https://forum.ansible.com/t/unarchive-module-fails/18930/2 "2015-08-04T16:46:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [August 7, 2015, 9:43am UTC](https://forum.ansible.com/t/unarchive-module-fails/18930/3 "2015-08-07T09:43:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Andy\_Brittingham](https://avatars.discourse-cdn.com/v4/letter/a/a9adbd/32.png) [@Andy\_Brittingham](https://forum.ansible.com/u/Andy_Brittingham)\
**Post date:** [August 13, 2015, 6:39pm UTC](https://forum.ansible.com/t/unarchive-module-fails/18930/4 "2015-08-13T18:39:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Thibaud\_Lepretre](https://avatars.discourse-cdn.com/v4/letter/t/54ee81/32.png) [@Thibaud\_Lepretre](https://forum.ansible.com/u/Thibaud_Lepretre)\
**Post date:** [August 19, 2015, 6:56am UTC](https://forum.ansible.com/t/unarchive-module-fails/18930/5 "2015-08-19T06:56:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [August 20, 2015, 1:16pm UTC](https://forum.ansible.com/t/unarchive-module-fails/18930/6 "2015-08-20T13:16:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [August 20, 2015, 3:44pm UTC](https://forum.ansible.com/t/unarchive-module-fails/18930/7 "2015-08-20T15:44:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Toshio\_Kuratomi](https://avatars.discourse-cdn.com/v4/letter/t/41988e/32.png) [@Toshio\_Kuratomi](https://forum.ansible.com/u/Toshio_Kuratomi)\
**Post date:** [August 20, 2015, 3:48pm UTC](https://forum.ansible.com/t/unarchive-module-fails/18930/8 "2015-08-20T15:48:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![\_Catie](https://avatars.discourse-cdn.com/v4/letter/_/e8c25b/32.png) [@\_Catie](https://forum.ansible.com/u/_Catie)\
**Post date:** [June 27, 2017, 7:07pm UTC](https://forum.ansible.com/t/unarchive-module-fails/18930/9 "2017-06-27T19:07:01Z")

</div>

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
