diff --git a/changelogs/fragments/remove_pc_vars_round.yml b/changelogs/fragments/remove_pc_vars_round.yml new file mode 100644 index 00000000000..e2eddacfc7a --- /dev/null +++ b/changelogs/fragments/remove_pc_vars_round.yml @@ -0,0 +1,2 @@ +bugfixes: + - remove update/restore of vars from play_context as it is now redundant. diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index 4bb9ea31414..1366c767287 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -203,18 +203,6 @@ class TaskExecutor: and returns the items result. ''' - # save the play context variables to a temporary dictionary, - # so that we can modify the job vars without doing a full copy - # and later restore them to avoid modifying things too early - play_context_vars = dict() - self._play_context.update_vars(play_context_vars) - - old_vars = dict() - for k in play_context_vars: - if k in self._job_vars: - old_vars[k] = self._job_vars[k] - self._job_vars[k] = play_context_vars[k] - # get search path for this task to pass to lookup plugins self._job_vars['ansible_search_path'] = self._task.get_search_path() @@ -264,15 +252,6 @@ class TaskExecutor: " try adding wantlist=True to your lookup invocation or use q/query instead of lookup." % items ) - # now we restore any old job variables that may have been modified, - # and delete them if they were in the play context vars but not in - # the old variables dictionary - for k in play_context_vars: - if k in old_vars: - self._job_vars[k] = old_vars[k] - else: - del self._job_vars[k] - return items def _run_loop(self, items):