Tanay Suthar
Tanay Suthar

Reputation: 453

Cannot unzip the file located on remote centos machine using Ansible

- 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?

Upvotes: 9

Views: 14070

Answers (2)

siva nagi reddy
siva nagi reddy

Reputation: 47

add option "remote_src: yes" to unarchive module declaration

you can find it over here ""http://docs.ansible.com/ansible/latest/unarchive_module.html

Upvotes: 0

helloV
helloV

Reputation: 52413

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.

Upvotes: 30

Related Questions