I tried this but it copying the file on both the location on both the machines.
On Friday, March 3, 2017 at 3:03:04 PM UTC+5:30, niraj pandey wrote: > > > > down votefavorite > <http://stackoverflow.com/questions/42433905/ansible-copy-file#> > > How can I copy a file from machine A to machine B and machine C on > different location. ie: > > On machine A I have file abc and I want to copy it on the /tmp area of > machine B and /opt area of machine C. > > > I tried this so far: > > > *My inventory file:* > > > [webserver] > > machine-B dst=/tmp > > machine-C dst=/opt > > > *Playbook:* > > > - hosts: webserver > > tasks: > > - name: Transfer file from ServerA to ServerB > > synchronize: > > src: /home/niraj/ansible_testing > > dest: "{{ hostvars[item]['dst'] }}" > > with_items: "{{ groups['webserver'] }}" > > #dest: /home/niraj > > #mode: pull > > delegate_to: machine-A > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9edabaf2-fe96-45d8-8549-cfe158e76b81%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
