From 3bec76fc85647d041f4d6f6919902287987aaed4 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Fri, 16 Mar 2018 15:34:30 -0400 Subject: [PATCH] Avoid 2nd processing of facts for actions include_vars and set_fact are already updating hostvars in strategy no need to 're add again' with lower priority the same data. fixes #37535, mostly by avoiding reprocessing and 'cleaning' --- lib/ansible/executor/task_executor.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/executor/task_executor.py b/lib/ansible/executor/task_executor.py index e3a1201978..bc1569c404 100644 --- a/lib/ansible/executor/task_executor.py +++ b/lib/ansible/executor/task_executor.py @@ -593,7 +593,7 @@ class TaskExecutor: failed_when_result = False return failed_when_result - if 'ansible_facts' in result: + if 'ansible_facts' in result and self._task.action not in ('set_fact', 'include_vars'): vars_copy.update(namespace_facts(result['ansible_facts'])) if C.INJECT_FACTS_AS_VARS: vars_copy.update(clean_facts(result['ansible_facts'])) @@ -651,7 +651,7 @@ class TaskExecutor: if self._task.register: variables[self._task.register] = wrap_var(result) - if 'ansible_facts' in result: + if 'ansible_facts' in result and self._task.action not in ('set_fact', 'include_vars'): variables.update(namespace_facts(result['ansible_facts'])) if C.INJECT_FACTS_AS_VARS: variables.update(clean_facts(result['ansible_facts']))