On 16. des. 2016 19:12, Kevin Csuka wrote:
Here is a playbook to test it locally.
---
- hosts: my-3-nodes
tasks:
- stat:
path: /tmp/hi
register: me
- shell: echo
when: me.stat.exists == true and ...
On node 2 and 3 perform:
$: touch /tmp/hi
tasks:
- stat:
path: /tmp/hi
register: me
- set_fact:
run_on: "{{ item }}"
with_items: "{{ play_hosts }}"
when: run_on is undefined and hostvars[item].me.stat.exists
run_once: true
- shell: echo
when: inventory_hostname == run_on
--
Kai Stian Olstad
--
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/b86da079-5b7f-af3f-3f0a-9d1fdc084cf2%40olstad.com.
For more options, visit https://groups.google.com/d/optout.