i want to synchronize (copy) files between two remote hosts :.
Under my playbook , i'm running my tasks on several groups relativley to every task case.
My playbook looks like this :
---
- hosts: myHosts
gather_facts: true
become: true
become_user: "{{ ansi_user }}"
vars:
- buildServer_host : "127.78.11.04"
roles:
#... Different roles
...
- { role: myRole }
My inventory file looks like this :
[myHosts]
myGroupA
myGroupB
myGroupC
Under myRole , i ve this task :
- name: Copy jars to API server
synchronize:
src: "{{ Workspace_GEN_COLIS }}/{{item.item}}/target/{{item.stdout}}"
dest: "/opt/application/i99was/{{RCD_DEF_VERSION}}/{{item.item}}.jar"
with_items: "{{ jarFileNames.results }}"
when:
- ansible_host in groups['myGroupB']
delegate_to: "{{buildServer_host }}"
As you can see : i want to transfer file from my "buildServer_host" to the re other remote destination which is only the group "myGroupB"
This fails , and i ve no idea why .
It seems like it doen't understand this : ansible_host in groups['myGroupB']
as a destination host
Suggestions ?