|
|
@ -211,30 +211,21 @@ class StrategyModule(StrategyBase):
|
|
|
|
skip_rest = True
|
|
|
|
skip_rest = True
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
run_once = templar.template(task.run_once) or action and getattr(action, 'BYPASS_HOST_LOOP', False)
|
|
|
|
run_once = action and getattr(action, 'BYPASS_HOST_LOOP', False) or templar.template(task.run_once)
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
task.name = to_text(templar.template(task.name, fail_on_undefined=False), nonstring='empty')
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
display.debug(f"Failed to templalte task name ({task.name}), ignoring error and continuing: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
if (task.any_errors_fatal or run_once) and not task.ignore_errors:
|
|
|
|
if (task.any_errors_fatal or run_once) and not task.ignore_errors:
|
|
|
|
any_errors_fatal = True
|
|
|
|
any_errors_fatal = True
|
|
|
|
|
|
|
|
|
|
|
|
if not callback_sent:
|
|
|
|
if not callback_sent:
|
|
|
|
display.debug("sending task start callback, copying the task so we can template it temporarily")
|
|
|
|
|
|
|
|
saved_name = task.name
|
|
|
|
|
|
|
|
display.debug("done copying, going to template now")
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
task.name = to_text(templar.template(task.name, fail_on_undefined=False), nonstring='empty')
|
|
|
|
|
|
|
|
display.debug("done templating")
|
|
|
|
|
|
|
|
except Exception:
|
|
|
|
|
|
|
|
# just ignore any errors during task name templating,
|
|
|
|
|
|
|
|
# we don't care if it just shows the raw name
|
|
|
|
|
|
|
|
display.debug("templating failed for some reason")
|
|
|
|
|
|
|
|
display.debug("here goes the callback...")
|
|
|
|
|
|
|
|
if isinstance(task, Handler):
|
|
|
|
if isinstance(task, Handler):
|
|
|
|
self._tqm.send_callback('v2_playbook_on_handler_task_start', task)
|
|
|
|
self._tqm.send_callback('v2_playbook_on_handler_task_start', task)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self._tqm.send_callback('v2_playbook_on_task_start', task, is_conditional=False)
|
|
|
|
self._tqm.send_callback('v2_playbook_on_task_start', task, is_conditional=False)
|
|
|
|
task.name = saved_name
|
|
|
|
|
|
|
|
callback_sent = True
|
|
|
|
callback_sent = True
|
|
|
|
display.debug("sending task start callback")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self._blocked_hosts[host.get_name()] = True
|
|
|
|
self._blocked_hosts[host.get_name()] = True
|
|
|
|
self._queue_task(host, task, task_vars, play_context)
|
|
|
|
self._queue_task(host, task, task_vars, play_context)
|
|
|
|