1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #1201 from dhozac/setup-once-per-node

Only gather facts once per node per playbook run
This commit is contained in:
Michael DeHaan 2012-10-02 06:36:31 -07:00
commit e1b1702616
2 changed files with 6 additions and 2 deletions

View file

@ -314,7 +314,11 @@ class PlayBook(object):
host_list = [ h for h in self.inventory.list_hosts(play.hosts) host_list = [ h for h in self.inventory.list_hosts(play.hosts)
if not (h in self.stats.failures or h in self.stats.dark) ] if not (h in self.stats.failures or h in self.stats.dark) ]
if not play.gather_facts: if play.gather_facts is False:
return {}
elif play.gather_facts is None:
host_list = [h for h in host_list if h not in self.SETUP_CACHE]
if len(host_list) == 0:
return {} return {}
self.callbacks.on_setup() self.callbacks.on_setup()

View file

@ -75,7 +75,7 @@ class Play(object):
self.sudo_user = utils.template(basedir, ds.get('sudo_user', self.playbook.sudo_user), playbook.extra_vars) self.sudo_user = utils.template(basedir, ds.get('sudo_user', self.playbook.sudo_user), playbook.extra_vars)
self.transport = ds.get('connection', self.playbook.transport) self.transport = ds.get('connection', self.playbook.transport)
self.tags = ds.get('tags', None) self.tags = ds.get('tags', None)
self.gather_facts = ds.get('gather_facts', True) self.gather_facts = ds.get('gather_facts', None)
self.serial = ds.get('serial', 0) self.serial = ds.get('serial', 0)
self._update_vars_files_for_host(None) self._update_vars_files_for_host(None)