I've got a case where I need to run a command on a specific group of hosts
when a certain file exists. The playbook is being run on two host groups
(a and b). I'm trying to figure out the best way to create the logic to
make this work.
Currently I've got this:
- name: Run A on each group if file exists
shell: script.sh
when: file.stat.exists == true
delegate_to: "{{ item }}"
with_items: groups.a
What I'm not sure of is if this would work. Basically, I was script.sh to
run on every host in group A when a certain file exists. Will this task
work? If not, is there a correct way of doing this? One example has the
delegate_to with items moved off into a handler, which is fine as long as I
get the syntax right on the with_items.
Any ideas?
--
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/a91cf76e-9831-4dd8-9d0e-cf79a1641572%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.