I'm using the command module inside my playbook, and it currently looks like this.
- hosts: all
tasks:
- name: Update tar file
command: sudo scp -r username@hostname:/path/from/destination /path/to/destination
I've omitted the tasks the take place before this task for the purpose of readability, but what happens when I run this playbook is that it stop at this task. It simply doesn't move forward. I'm sure this is because sudo, so It may want the password for that. I'm not sure how to fix that however.
You want to use the fetch module.
- hosts: host.example.com
tasks:
# Copy remote file (host.example.com:/tmp/somefile) into
# /tmp/fetched/host.example.com/tmp/somefile on local machine
- fetch:
src: /tmp/somefile
dest: /tmp/fetched
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With