mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Abort a play at the start when no hosts matches, or no hosts are remaining
This change makes a distinction between no_hosts_matched and no_hosts_remaining. In both cases we do not start facts-gathering, or run any tasks. In the case that there are no more hosts remaining, we abort running tasks and abort the playbook. I also cleaned up the leftovers from the previous patchsets, as these are no longer required. This closes #1187. Example playbook: ```yaml --- - hosts: emptygroup tasks: - action: command date - action: command false - hosts: all gather_facts: False tasks: - action: command ls - action: command false - action: command true - hosts: all tasks: - action: command true - action: command false - hosts: all tasks: - action: command pwd ```
This commit is contained in:
@@ -63,6 +63,12 @@ class CallbackModule(object):
|
||||
def playbook_on_notify(self, host, handler):
|
||||
pass
|
||||
|
||||
def on_no_hosts_matched(self):
|
||||
pass
|
||||
|
||||
def on_no_hosts_remaining(self):
|
||||
pass
|
||||
|
||||
def playbook_on_task_start(self, name, is_conditional):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user