mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 11:51:26 -07:00
parent
21b76dee6f
commit
56e5e72aaa
2 changed files with 12 additions and 1 deletions
|
@ -502,12 +502,24 @@ class StrategyBase:
|
||||||
if notified_hosts is None:
|
if notified_hosts is None:
|
||||||
notified_hosts = self._notified_handlers[handler_name]
|
notified_hosts = self._notified_handlers[handler_name]
|
||||||
|
|
||||||
|
run_once = False
|
||||||
|
try:
|
||||||
|
action = action_loader.get(handler.action, class_only=True)
|
||||||
|
if handler.run_once or getattr(action, 'BYPASS_HOST_LOOP', False):
|
||||||
|
run_once = True
|
||||||
|
except KeyError:
|
||||||
|
# we don't care here, because the action may simply not have a
|
||||||
|
# corresponding action plugin
|
||||||
|
pass
|
||||||
|
|
||||||
host_results = []
|
host_results = []
|
||||||
for host in notified_hosts:
|
for host in notified_hosts:
|
||||||
if not handler.has_triggered(host) and (host.name not in self._tqm._failed_hosts or play_context.force_handlers):
|
if not handler.has_triggered(host) and (host.name not in self._tqm._failed_hosts or play_context.force_handlers):
|
||||||
task_vars = self._variable_manager.get_vars(loader=self._loader, play=iterator._play, host=host, task=handler)
|
task_vars = self._variable_manager.get_vars(loader=self._loader, play=iterator._play, host=host, task=handler)
|
||||||
task_vars = self.add_tqm_variables(task_vars, play=iterator._play)
|
task_vars = self.add_tqm_variables(task_vars, play=iterator._play)
|
||||||
self._queue_task(host, handler, task_vars, play_context)
|
self._queue_task(host, handler, task_vars, play_context)
|
||||||
|
if run_once:
|
||||||
|
break
|
||||||
|
|
||||||
# collect the results from the handler run
|
# collect the results from the handler run
|
||||||
host_results = self._wait_on_pending_results(iterator)
|
host_results = self._wait_on_pending_results(iterator)
|
||||||
|
|
|
@ -176,7 +176,6 @@ class StrategyModule(StrategyBase):
|
||||||
run_once = False
|
run_once = False
|
||||||
work_to_do = True
|
work_to_do = True
|
||||||
|
|
||||||
|
|
||||||
# test to see if the task across all hosts points to an action plugin which
|
# test to see if the task across all hosts points to an action plugin which
|
||||||
# sets BYPASS_HOST_LOOP to true, or if it has run_once enabled. If so, we
|
# sets BYPASS_HOST_LOOP to true, or if it has run_once enabled. If so, we
|
||||||
# will only send this task to the first host in the list.
|
# will only send this task to the first host in the list.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue