My issue is pushing groups of hosts through this playbook:
host1 needs to push files to host8
host4 needs to push files to host12
host7 needs to push files to host3
host9 needs to push files to host5
etc...
so what should the inventory file look like to process groups of hosts with
1:1 relationship?
---
- hosts: all
become: yes
tasks:
- name: Fetch the file from the {{ ansible_hostname }} to master
run_once: yes
fetch:
src: "{{ item }}"
dest: buffer/
flat: yes
with_items:
- "/tmp/foo1"
- "/tmp/foo2"
- name: Copy the file from master to host2
copy:
src: "{{ item }}"
dest: /tmp/
owner: root
group: root
mode: 0777
with_items:
- "buffer/foo1"
- "buffer/foo2"
when: "{{ ansible_hostname == 'host8' }}"
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/08bb2b6e-b057-45f0-9cb9-098cdf9972be%40googlegroups.com.