Transfer files from Server A to Server B

Hi Community Members,

I am writing an Ansible playbook for which I want to copy files directly from Server A to Server B directly, skipping the Ansible node, i.e., I do not want to use Fetch and Copy module. I have tried the synchronize module to do the said task but however, it fails with the following error:
"item", "changed": false, "cmd": "sshpass", "item":ABC.csv "msg": "[Errno 2] No such file or directory", "rc": 2}​​​​​​\nfailed

If anyone has done something similar, can you guide us how we can accomplish this? Any help is appreciated.

Thanks
Shivam

Hi…

You can use fetch and copy… clean up on control node in same playbook . We are doing for security files…

Thanks

Hi Raja

Can you please share a sample playbook where you need to fetch files from one node and transfer those file to multiple nodes.

Hi Raja

Can you please share a sample playbook where you need to fetch files from one node and transfer those file to multiple nodes.

It looks like the sshpass binary is missing, probably on the controller.

Regards
          Racke

Dear Raja,
do remember:

  1. Use delegate_to in order to make synchronize module moves between managed nodes
  2. from serverA to serverB you should ensure a connection mechanism is in place, preferably non interactive. For e.g. ssh passwordless

example playbook: