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/2e7572ed-986d-4318-8198-d10ba38c1e6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to