My playbook with shell module
- name: Unarchive macports from local machine
shell: |
tar -xvf MacPorts-2.6.2.tar.gz
cd MacPorts-2.6.2
./configure
make
make install
Error
[WARNING]: Consider using the unarchive module rather than running 'tar'. If you need to use command because unarchive is insufficient you can add 'warn: false' to
this command task or set 'command_warnings=False' in ansible.cfg to get rid of this message.
fatal: [X.X.X.X]: FAILED! => {"changed": true, "cmd": "tar -xvf MacPorts-2.6.2.tar.gz\ncd MacPorts-2.6.2\n./configure\nmake \nmake install\n", "delta": "0:00:00.026259", "end": "2020-06-03 15:54:26.259407", "msg": "non-zero return code", "rc": 2, "start": "2020-06-03 15:54:26.233148", "stderr": "tar: Error opening archive: Failed to open 'MacPorts-2.6.2.tar.gz'\n/bin/sh: line 1: cd: MacPorts-2.6.2: No such file or directory\n/bin/sh: line 2: ./configure: No such file or directory\nmake: * No targets specified and no makefile found. Stop.\nmake: * No rule to make target install'. Stop.", "stderr_lines": ["tar: Error opening archive: Failed to open 'MacPorts-2.6.2.tar.gz'", "/bin/sh: line 1: cd: MacPorts-2.6.2: No such file or directory", "/bin/sh: line 2: ./configure: No such file or directory", "make: *** No targets specified and no makefile found. Stop.", "make: *** No rule to make target
install'. Stop."], "stdout": "", "stdout_lines": []}
But i have tar.gz file in target machine, when I use unarchive module to untar facing below issue
TASK [Unarchive macports from local machine] ************************************************************************************************************************** fatal: [X.X.X.]: FAILED! => {"changed": false, "msg": "Failed to find handler for \"/Users/pru5/Documents/ansible/MacPorts-2.6.2.tar.gz\". Make sure the required command to extract the file is installed. Command \"/usr/bin/tar\" detected as tar type bsd. GNU tar required. Command \"/usr/bin/unzip\" could not handle archive."} can someone help me to untar file in mac??