mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
avoid x2 setting of set_fact when 'cacheable' (#50564)
* avoid x2 setting of set_fact when 'cacheable' fixes #50556 * ammend docs to new behaviour * added period
This commit is contained in:
committed by
Sandra McCann
parent
c7f3829ad4
commit
207848f354
@@ -684,7 +684,7 @@ class TaskExecutor:
|
||||
return failed_when_result
|
||||
|
||||
if 'ansible_facts' in result:
|
||||
if self._task.action in ('set_fact', 'include_vars'):
|
||||
if self._task.action in ('include_vars', 'set_fact'):
|
||||
vars_copy.update(result['ansible_facts'])
|
||||
else:
|
||||
# TODO: cleaning of facts should eventually become part of taskresults instead of vars
|
||||
|
||||
@@ -570,10 +570,10 @@ class StrategyBase:
|
||||
else:
|
||||
cacheable = result_item.pop('_ansible_facts_cacheable', False)
|
||||
for target_host in host_list:
|
||||
if not original_task.action == 'set_fact' or cacheable:
|
||||
self._variable_manager.set_host_facts(target_host, result_item['ansible_facts'].copy())
|
||||
if original_task.action == 'set_fact':
|
||||
if original_task.action == 'set_fact' and not cacheable:
|
||||
self._variable_manager.set_nonpersistent_facts(target_host, result_item['ansible_facts'].copy())
|
||||
else:
|
||||
self._variable_manager.set_host_facts(target_host, result_item['ansible_facts'].copy())
|
||||
|
||||
if 'ansible_stats' in result_item and 'data' in result_item['ansible_stats'] and result_item['ansible_stats']['data']:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user