On Friday, 2 March 2018 20.54.15 CET Check Peck wrote:
> Ok got it. But if I try this way by using shell module:
>
> ---
> - hosts: TEST_BOX
> serial: 1
> tasks:
> - name: copy and untar latest deals.tar.gz file
> shell: "cd /data/tasks/files/; tar -xvzf test.tar.gz"
>
>
> It doesn't work and I get an error like this: Am I doing anything wrong
> with my above tasks?
>
> fatal: [machine_abc]: FAILED! => {"changed": true, "cmd": "cd
> /data/tasks/files/; tar -xvzf test.tar.gz", "delta": "0:00:00.022610",
> "end": "2018-03-02 12:47:56.840245", "msg": "non-zero return code", "rc":
> 2, "start": "2018-03-02 12:47:56.817635", "stderr": "tar (child):
> test.tar.gz: Cannot open: No such file or directory\ntar (child): Error is
> not recoverable: exiting now\ntar: Child returned status 2\ntar: Error is
> not recoverable: exiting now", "stderr_lines": ["tar (child): test.tar.gz:
> Cannot open: No such file or directory", "tar (child): Error is not
> recoverable: exiting now", "tar: Child returned status 2", "tar: Error is
> not recoverable: exiting now"], "stdout": "", "stdout_lines": []}
You need to transfer the file to the host first.
So that's why I in my example used curl, it will get the file and then send them in memory to tar that untar the files and save them to disk.
--
Kai Stian Olstad