I want to copy files from one server to another using Ansible. Below is the example
Server A ------> Server B
Server C ------> Server D
I have my one file on Server A and specifically want to copy that file on to the server B, and same for server C to D. Folder to save files to the destination is the same. I can do it for 2 or 3 hosts. But how can I create dynamically for let us say 100 nodes to copy particular single file assign to desired server only.
[source_hosts]host1 file_path=/etc/... dest_host=another_hostname- hosts: source_hosts tasks:
- fetch: src={{src_path}} dest=/tmp/...
- delegate_to:"{{dest_host}}"
copy: src={{/tmp/...}} dest={{file_path}}