mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-01 16:23:10 +00:00
Make sure setting facts with run_once makes copies of the data
When using run_once, there is only one dict of facts so passing that to the VariableManager results in the fact cache containing the same dictionary reference for all hosts in inventory. This patch fixes that by making sure we pass a copy of the facts dict to VariableManager. Fixes #14279
This commit is contained in:
@@ -377,9 +377,9 @@ class StrategyBase:
|
||||
facts = result[4]
|
||||
for target_host in host_list:
|
||||
if task.action == 'set_fact':
|
||||
self._variable_manager.set_nonpersistent_facts(target_host, facts)
|
||||
self._variable_manager.set_nonpersistent_facts(target_host, facts.copy())
|
||||
else:
|
||||
self._variable_manager.set_host_facts(target_host, facts)
|
||||
self._variable_manager.set_host_facts(target_host, facts.copy())
|
||||
elif result[0].startswith('v2_runner_item') or result[0] == 'v2_runner_retry':
|
||||
self._tqm.send_callback(result[0], result[1])
|
||||
elif result[0] == 'v2_on_file_diff':
|
||||
|
||||
Reference in New Issue
Block a user