Fix gather_facts assumption that SETUP_CACHE for a host is empty
We now check explicitely for 'module_setup' in the SETUP_CACHE in order to avoid skipping setup because SETUP_CACHE was populated some other way. Other modules can implement the same mechanism to test if they've already run. This closes #1206.
This commit is contained in:
parent
e1b1702616
commit
fedfd18774
1 changed files with 2 additions and 1 deletions
|
@ -317,7 +317,7 @@ class PlayBook(object):
|
||||||
if play.gather_facts is False:
|
if play.gather_facts is False:
|
||||||
return {}
|
return {}
|
||||||
elif play.gather_facts is None:
|
elif play.gather_facts is None:
|
||||||
host_list = [h for h in host_list if h not in self.SETUP_CACHE]
|
host_list = [h for h in host_list if h not in self.SETUP_CACHE or 'module_setup' not in self.SETUP_CACHE[h]]
|
||||||
if len(host_list) == 0:
|
if len(host_list) == 0:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
@ -340,6 +340,7 @@ class PlayBook(object):
|
||||||
# let runner template out future commands
|
# let runner template out future commands
|
||||||
setup_ok = setup_results.get('contacted', {})
|
setup_ok = setup_results.get('contacted', {})
|
||||||
for (host, result) in setup_ok.iteritems():
|
for (host, result) in setup_ok.iteritems():
|
||||||
|
self.SETUP_CACHE[host].update({'module_setup': True})
|
||||||
self.SETUP_CACHE[host].update(result.get('ansible_facts', {}))
|
self.SETUP_CACHE[host].update(result.get('ansible_facts', {}))
|
||||||
return setup_results
|
return setup_results
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue