Hello all!
I have an issue in my environment where I cannot use the synchronize
module to transfer data between two remote nodes. So I need a different way
to do this.
ServerA: Ansible Server (Tower Instance)
ServerA1: Ansible Server (Tower Instance)
ServerA2: Ansible Server (Tower Instance)
ServerB: Data Server
ServerC: User Server
I want to run a playbook on ServerA and have it copy a/many file(s) from
ServerB to ServerC. I cannot use synchronize do to environmental issues. So
how can I get this done ether using copy or fetch modules. Or something
else like SCP from the shell or command module.
I cannot find a good example of doing this other than the synchronize
module. I do not want to just copy the data files to the tower servers. I
need to keep my environment the same as it is today without changes.
I'm using ansible 2.7. These are all Redhat Linux Servers.
Here is a sample I tried. Really simple but...Inventory comes from tower
server which is why the hosts says "all"
---
- name: Playbook1
hosts: all
gather_facts: yes
become: yes
remote_user: user1
tasks:
- name: Copy file to dest server
fetch:
src: "/var/tmp/file1"
dest: "/var/tmp/"
flat: yes
delegate_to: ServerB
---
- name: Playbook2
hosts: all
gather_facts: yes
become: yes
remote_user: user1
tasks:
- name: Copy file to dest server
copy:
src: "/var/tmp/file1"
dest: "/var/tmp/"
remote_src: yes
delegate_to: ServerB
Any help would be appreciated.
Regards,
Glen
--
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/b33aa0a8-c51d-4293-bee0-0d7326a5f58f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.