Using Ansible v2.9.12
Question: How do I set a variable for all hosts in the play, when at least one host has a certain condition which is met.
Example:
- hosts:
- host1
- host2
- host3
- host4
tasks:
- stat:
path: /tmp/file
register: something
- set_fact
something: true
when: something <at least one of the hosts has /tmp/file>
Now, only host4 has /tmp/file
present in it's filesystem. How would I set the fact for all hosts in this case?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…