0

The end goal is for me to copy file.txt from Host2 over to Host1. However, I keep getting the same error whenever I perform the function. I have triple checked my spacing and made sure I spelled everything correctly, but nothing seems to work.

Command to start the playbook:

ansible-playbook playbook_name.yml -i inventory/inventory_name -u username -k

My Code:

- hosts: Host1
  tasks: 


  - name: Synchronization using rsync protocol on delegate host (pull)
    synchronize:
        mode: pull
        src: rsync://Host2.linux.us.com/tmp/file.txt
        dest: /tmp
    delegate_to: Host2.linux.us.com

Expected Result:

Successfully working

Actual Result:

fatal: [Host1.linux.us.com]: FAILED! => {"changed": false, "cmd": "sshpass", "msg": "[Errno 2] No such file or directory", "rc": 2}
robert.kane
  • 99
  • 3
  • 12
  • you are trying to copy from host2 to host1. in that case, you don't need mode: pull. remove the mode: pull and give a try – Ada Pongaya Aug 01 '19 at 05:25
  • this question has been answered in multiple cases. https://stackoverflow.com/questions/25505146/how-to-copy-files-between-two-nodes-using-ansible – Ada Pongaya Aug 01 '19 at 05:30

1 Answers1

2

I have the same problem as you,Installing sshpass on the target host can work normally yum install -y sshpass

xiaohu lv
  • 21
  • 2