Commit 1a4e6e41 by Serge van Ginderachter Committed by James Cammarata

Check for ansible_facts in results for with_ tasks

that loop over a lookup plugin. Fixes #3704 and #3735
parent 40e60c94
...@@ -361,6 +361,13 @@ class PlayBook(object): ...@@ -361,6 +361,13 @@ class PlayBook(object):
# add facts to the global setup cache # add facts to the global setup cache
for host, result in contacted.iteritems(): for host, result in contacted.iteritems():
if 'results' in result:
# task ran with_ lookup plugin, so facts are encapsulated in
# multiple list items in the results key
for res in result['results']:
facts = res.get('ansible_facts', {})
self.SETUP_CACHE[host].update(facts)
else:
facts = result.get('ansible_facts', {}) facts = result.get('ansible_facts', {})
self.SETUP_CACHE[host].update(facts) self.SETUP_CACHE[host].update(facts)
# extra vars need to always trump - so update again following the facts # extra vars need to always trump - so update again following the facts
......
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