mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Things that happen inside multiprocessing shouldn't make side effects, ergo append ansible_facts only
in playbook code. This technically means with_items calls can't continuously add facts I guess, but I can't see anyone ever trying that.
This commit is contained in:
parent
51739fc47d
commit
19fc8eea80
2 changed files with 5 additions and 2 deletions
|
@ -221,6 +221,11 @@ class PlayBook(object):
|
||||||
results = {}
|
results = {}
|
||||||
|
|
||||||
self.stats.compute(results)
|
self.stats.compute(results)
|
||||||
|
|
||||||
|
# add facts to the global setup cache
|
||||||
|
for host, result in results['contacted'].iteritems():
|
||||||
|
facts = result.get('ansible_facts', {})
|
||||||
|
self.SETUP_CACHE[host].update(facts)
|
||||||
|
|
||||||
# flag which notify handlers need to be run
|
# flag which notify handlers need to be run
|
||||||
if len(task.notify) > 0:
|
if len(task.notify) > 0:
|
||||||
|
|
|
@ -248,8 +248,6 @@ class Runner(object):
|
||||||
self.module_args += " #USE_SHELL"
|
self.module_args += " #USE_SHELL"
|
||||||
|
|
||||||
exec_rc = self._execute_module(conn, tmp, module_name, self.module_args, inject=inject)
|
exec_rc = self._execute_module(conn, tmp, module_name, self.module_args, inject=inject)
|
||||||
if exec_rc.is_successful():
|
|
||||||
self.setup_cache[conn.host].update(exec_rc.result.get('ansible_facts', {}))
|
|
||||||
return exec_rc
|
return exec_rc
|
||||||
|
|
||||||
# *****************************************************
|
# *****************************************************
|
||||||
|
|
Loading…
Reference in a new issue