From d2bade6dafee19d7d010e8f18744f02409864980 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Fri, 13 May 2016 10:00:23 -0400 Subject: [PATCH] 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 --- lib/ansible/plugins/strategy/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/plugins/strategy/__init__.py b/lib/ansible/plugins/strategy/__init__.py index 25b27915774..c93626a7ede 100644 --- a/lib/ansible/plugins/strategy/__init__.py +++ b/lib/ansible/plugins/strategy/__init__.py @@ -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':