1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Make sure run_once tasks also set any_errors_fatal so all hosts fail

Currently implemented only in the linear strategy (free strategy simply
ignores run_once/BYPASS_HOST_LOOP actions).

Fixes #14252
This commit is contained in:
James Cammarata 2016-02-05 10:58:24 -05:00
parent b713f1ca53
commit 27f9cc05f8

View file

@ -190,9 +190,6 @@ class StrategyModule(StrategyBase):
run_once = False
work_to_do = True
if task.any_errors_fatal:
any_errors_fatal = True
# 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
# will only send this task to the first host in the list.
@ -230,7 +227,10 @@ class StrategyModule(StrategyBase):
templar = Templar(loader=self._loader, variables=task_vars)
display.debug("done getting variables")
run_once = templar.template(task.run_once)
run_once = templar.template(task.run_once) or getattr(action, 'BYPASS_HOST_LOOP', False)
if task.any_errors_fatal or run_once:
any_errors_fatal = True
if not callback_sent:
display.debug("sending task start callback, copying the task so we can template it temporarily")
@ -254,7 +254,7 @@ class StrategyModule(StrategyBase):
self._queue_task(host, task, task_vars, play_context)
# if we're bypassing the host loop, break out now
if run_once or getattr(action, 'BYPASS_HOST_LOOP', False):
if run_once:
break
results += self._process_pending_results(iterator, one_pass=True)