@ -387,7 +387,6 @@ class TaskExecutor:
# make a copy of the job vars here, in case we need to update them
# with the registered variable value later on when testing conditions
#vars_copy = variables.copy()
vars_copy = variables . copy ( )
display . debug ( " starting attempt loop " )
@ -404,6 +403,11 @@ class TaskExecutor:
return dict ( unreachable = True , msg = to_unicode ( e ) )
display . debug ( " handler run complete " )
# update the local copy of vars with the registered value, if specified,
# or any facts which may have been generated by the module execution
if self . _task . register :
vars_copy [ self . _task . register ] = result
if self . _task . async > 0 :
# the async_wrapper module returns dumped JSON via its stdout
# response, so we parse it here and replace the result
@ -433,11 +437,6 @@ class TaskExecutor:
return failed_when_result
return False
# update the local copy of vars with the registered value, if specified,
# or any facts which may have been generated by the module execution
if self . _task . register :
vars_copy [ self . _task . register ] = result
if ' ansible_facts ' in result :
vars_copy . update ( result [ ' ansible_facts ' ] )