Commit 19fc8eea by Michael DeHaan

Things that happen inside multiprocessing shouldn't make side effects, ergo…

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.
parent 51739fc4
...@@ -221,6 +221,11 @@ class PlayBook(object): ...@@ -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): ...@@ -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
# ***************************************************** # *****************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment