@ -137,6 +137,12 @@ class TaskExecutor:
self . _task . ignore_errors = item_ignore
self . _task . ignore_errors = item_ignore
elif self . _task . ignore_errors and not item_ignore :
elif self . _task . ignore_errors and not item_ignore :
self . _task . ignore_errors = item_ignore
self . _task . ignore_errors = item_ignore
if ' unreachable ' in item and item [ ' unreachable ' ] :
item_ignore_unreachable = item . pop ( ' _ansible_ignore_unreachable ' )
if not res . get ( ' unreachable ' ) :
self . _task . ignore_unreachable = item_ignore_unreachable
elif self . _task . ignore_unreachable and not item_ignore_unreachable :
self . _task . ignore_unreachable = item_ignore_unreachable
# ensure to accumulate these
# ensure to accumulate these
for array in [ ' warnings ' , ' deprecations ' ] :
for array in [ ' warnings ' , ' deprecations ' ] :
@ -277,6 +283,7 @@ class TaskExecutor:
u " to something else to avoid variable collisions and unexpected behavior. " % ( self . _task , loop_var ) )
u " to something else to avoid variable collisions and unexpected behavior. " % ( self . _task , loop_var ) )
ran_once = False
ran_once = False
task_fields = None
no_log = False
no_log = False
items_len = len ( items )
items_len = len ( items )
results = [ ]
results = [ ]
@ -348,6 +355,7 @@ class TaskExecutor:
res [ ' _ansible_item_result ' ] = True
res [ ' _ansible_item_result ' ] = True
res [ ' _ansible_ignore_errors ' ] = task_fields . get ( ' ignore_errors ' )
res [ ' _ansible_ignore_errors ' ] = task_fields . get ( ' ignore_errors ' )
res [ ' _ansible_ignore_unreachable ' ] = task_fields . get ( ' ignore_unreachable ' )
# gets templated here unlike rest of loop_control fields, depends on loop_var above
# gets templated here unlike rest of loop_control fields, depends on loop_var above
try :
try :
@ -392,6 +400,10 @@ class TaskExecutor:
del task_vars [ var ]
del task_vars [ var ]
self . _task . no_log = no_log
self . _task . no_log = no_log
# NOTE: run_once cannot contain loop vars because it's templated earlier also
# This is saving the post-validated field from the last loop so the strategy can use the templated value post task execution
self . _task . run_once = task_fields . get ( ' run_once ' )
self . _task . action = task_fields . get ( ' action ' )
return results
return results