Erhm, the solution is in the quoted text..
Here is a copy/paste:
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
--
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/e4a69b88-4801-44bb-8ef4-9524db956b9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.