# unarchive requirements?

**URL:** <https://forum.ansible.com/t/unarchive-requirements/14369>\
**Category:** Ansible Project\
**Created:** [January 17, 2014, 6:58pm UTC](https://forum.ansible.com/t/unarchive-requirements/14369 "2014-01-17T18:58:39Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Morris](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@Adam\_Morris](https://forum.ansible.com/u/Adam_Morris)\
**Post date:** [January 17, 2014, 6:58pm UTC](https://forum.ansible.com/t/unarchive-requirements/14369/1 "2014-01-17T18:58:39Z")

</div>

Greetings,

According to the documentation unarchive requires tar/unzip to work…

However it appears from my first attempt at using it that it requires GNU tar to work. Reading through the code it looks like it tries to determine what the archive format is and then supplies appropriate GNU tar options to the tar command in order to carry out its tasks.

I haven’t tested yet, but I suspect that I could provide it with an uncompressed tar file and have it work on AIX, but it certainly doesn’t work with a compressed one.

Does anyone have any thoughts on this? I’m not sure how you could improve the module though…

Adam

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [January 17, 2014, 7:01pm UTC](https://forum.ansible.com/t/unarchive-requirements/14369/2 "2014-01-17T19:01:22Z")

</div>

Since I'm already taking a look for issues with BSD directory detection, I  
might take a stab at making sure it is 'POSIX tar' compliant, sadly I have  
a lot of experience with that.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [January 19, 2014, 1:27am UTC](https://forum.ansible.com/t/unarchive-requirements/14369/3 "2014-01-19T01:27:22Z")

</div>

So it seems the big issue is having the compression support in tar (as GNU tar has), for other implementations we would need to always call the decompression program (gzip, etc).

---

<div class="post-metadata">

**Author:** ![Leibo](https://avatars.discourse-cdn.com/v4/letter/l/41988e/32.png) [@Leibo](https://forum.ansible.com/u/Leibo)\
**Post date:** [June 17, 2014, 8:29am UTC](https://forum.ansible.com/t/unarchive-requirements/14369/4 "2014-06-17T08:29:08Z")

</div>

Just encountered this on a HP-UX server…

ansible -i inventory/test\_hosts rx2600-hpux11iv3-x64 -u root -m shell -a “which tar”

rx2600-hpux11iv3-x64 | success | rc=0 \>\>  
/usr/bin/tar

I suppose it would be nice to test the detected tar command flags, if we detect a ‘z’ option, use it, if not - do this in 2 steps - uncomress and unarchive

# ansible -i inventory/test\_hosts rx2600-hpux11iv3-x64 -u root -m shell -a “tar z”

xavi-rx2600-hpux11iv3-x64 | FAILED | rc=1 \>\>  
**tar: z: unknown option**

And failover to a 2 step solution.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [June 17, 2014, 7:11pm UTC](https://forum.ansible.com/t/unarchive-requirements/14369/5 "2014-06-17T19:11:13Z")

</div>

We’re unlikely to want to run the extra steps to do the test all the time, and it would complicate the module considerably, I’d accept a PR to add a hint to the unarchive module though.

---

<div class="post-metadata">

**Author:** ![Leibo](https://avatars.discourse-cdn.com/v4/letter/l/41988e/32.png) [@Leibo](https://forum.ansible.com/u/Leibo)\
**Post date:** [June 17, 2014, 7:21pm UTC](https://forum.ansible.com/t/unarchive-requirements/14369/6 "2014-06-17T19:21:06Z")

</div>

Thanks,

if we can have a new parameter to explicitly tell the module to use 2 steps, like, gunzip and then tar xf it would cover this non GNU tar situations.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [June 17, 2014, 8:10pm UTC](https://forum.ansible.com/t/unarchive-requirements/14369/7 "2014-06-17T20:10:29Z")

</div>

gnu=no (default yes) maybe?

---

<div class="post-metadata">

**Author:** ![Leibo](https://avatars.discourse-cdn.com/v4/letter/l/41988e/32.png) [@Leibo](https://forum.ansible.com/u/Leibo)\
**Post date:** [June 17, 2014, 8:59pm UTC](https://forum.ansible.com/t/unarchive-requirements/14369/8 "2014-06-17T20:59:54Z")

</div>

Hi,

gnu=no/yes is great.

BTW, if we have other commands inside modules relying on GNU perhaps it will be good to have also a system level parameter that will affect all such modules.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [June 18, 2014, 3:33pm UTC](https://forum.ansible.com/t/unarchive-requirements/14369/9 "2014-06-18T15:33:55Z")

</div>

We don’t have any facility for module defaults like that at this time, so that may have to be considered later.

I’d consider it now if we didn’t have so many other things to consider first 🙂

But yes, in this case, let’s make gnu=yes/no so.
