From e4a3e5fdd736ba00631c81debad4efb57e8025da Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 26 Jan 2015 09:45:59 -0800 Subject: [PATCH] Prefer gtar to tar Fixes #702 --- lib/ansible/modules/files/unarchive.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/files/unarchive.py b/lib/ansible/modules/files/unarchive.py index fc2db0e6907..8e9c90fedcc 100644 --- a/lib/ansible/modules/files/unarchive.py +++ b/lib/ansible/modules/files/unarchive.py @@ -129,7 +129,11 @@ class TgzArchive(object): self.src = src self.dest = dest self.module = module - self.cmd_path = self.module.get_bin_path('tar') + # Prefer gtar (GNU tar) as it supports the compression options -zjJ + self.cmd_path = self.module.get_bin_path('gtar', None) + if not self.cmd_path: + # Fallback to tar + self.cmd_path = self.module.get_bin_path('tar') self.zipflag = 'z' self._files_in_archive = []