1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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'
This commit is contained in:
Brian Coca 2018-03-16 15:34:30 -04:00 committed by Brian Coca
parent 0633f73faf
commit 3bec76fc85

View file

@ -593,7 +593,7 @@ class TaskExecutor:
failed_when_result = False failed_when_result = False
return failed_when_result 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'])) vars_copy.update(namespace_facts(result['ansible_facts']))
if C.INJECT_FACTS_AS_VARS: if C.INJECT_FACTS_AS_VARS:
vars_copy.update(clean_facts(result['ansible_facts'])) vars_copy.update(clean_facts(result['ansible_facts']))
@ -651,7 +651,7 @@ class TaskExecutor:
if self._task.register: if self._task.register:
variables[self._task.register] = wrap_var(result) 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'])) variables.update(namespace_facts(result['ansible_facts']))
if C.INJECT_FACTS_AS_VARS: if C.INJECT_FACTS_AS_VARS:
variables.update(clean_facts(result['ansible_facts'])) variables.update(clean_facts(result['ansible_facts']))