I am trying to copy files from a remote host to my local server where I am running Ansible playbook. Though the task always executes successfully but the file is never copied to local server. Here is the code:
- file:
path: vm_info.config
mode: 0777
- fetch:
src: vm_info.config
dest: .
#flat: yes
fail_on_missing: yes
I tried copy module as well but none of them is getting me the result.
Best Answer
From fetch - Fetches a file from remote nodes
So look in
./remote-host/vm_info.config
. For example, your remote host is 192.168.1.3, the fetched file will be:./192.168.1.3/vm_info.config
If you had used -v option, it would have printed the location of the fetched file. I ran the playbook from /tmp directory.