Cannot unzip the file located on remote centos machine using Ansible

Tanay Suthar picture Tanay Suthar · Dec 30, 2015 · Viewed 11.6k times · Source
- name: Unzip the Elasticsearch file
  unarchive: src=/root/elasticsearch-1.4.0.tar.gz dest=/tmp/


TASK [Unzip the Elasticsearch file]     
*******************************************
fatal: [54.173.94.235]: FAILED! => {"failed": true, "msg": "ERROR! file or module does not exist: /root/elasticsearch-1.4.0.tar.gz"}

Is it consider the local file? ...I am running file on my local machine to unzip file on the remote machine. How can I solve this problem?

Answer

helloV picture helloV · Dec 30, 2015

By default, Ansible copies the file (src) from control machine to the remote machine and unarchives it. If you do not want Ansible to copy the file, set copy=no in your task.

The value of copy is yes by default, so Ansible will try to look for src file in the local machine if you do not set copy=no

unarchive: src=/root/elasticsearch-1.4.0.tar.gz dest=/tmp/ copy=no

Ansible - Unarchive

Copy

If true, the file is copied from local 'master' to the target machine, otherwise, the plugin will look for src archive at the target machine.