You need a play:
- hosts: localhost
gather_facts: false
tasks:
- shell: docker ps
delegate_to: '{{item}}'
with_items: '{{groups["servers"]}}'
register: mytest
when: mytest is undefined or mytest is failed
basically you are looping over the group and will execute the task
when 'test is undefined' which means that you never ran the task
(first host) or test is defined but has failed (only if previous hosts
failed, skip if previous succeed or skipped).
--
----------
Brian Coca
--
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/CACVha7fmV%3Dzz%3DqemGyJJaJFrFExz-uQug60%3DekQgc_VMbmZ0JQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.