Currently, if the host specified in delegate_to for a task is null, Ansible will crash with a stack trace. Add a check for this state and handle the error appropriately.
This commit is contained in:
parent
66f8fcea92
commit
fb50698da3
1 changed files with 2 additions and 0 deletions
|
@ -459,6 +459,8 @@ class VariableManager:
|
|||
|
||||
templar.set_available_variables(vars_copy)
|
||||
delegated_host_name = templar.template(task.delegate_to, fail_on_undefined=False)
|
||||
if not delegated_host_name:
|
||||
raise AnsibleError(message="Undefined delegate_to host for task:", obj=task._ds)
|
||||
if delegated_host_name in delegated_host_vars:
|
||||
# no need to repeat ourselves, as the delegate_to value
|
||||
# does not appear to be tied to the loop item variable
|
||||
|
|
Loading…
Reference in a new issue