mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 22:00:22 -07:00
added gathering control to ansible, defaults to 'smart'
This commit is contained in:
parent
a8514dacc3
commit
4dfa40f18e
4 changed files with 14 additions and 4 deletions
|
@ -479,11 +479,15 @@ class PlayBook(object):
|
|||
def _do_setup_step(self, play):
|
||||
''' get facts from the remote system '''
|
||||
|
||||
if play.gather_facts is False:
|
||||
return {}
|
||||
|
||||
host_list = self._trim_unavailable_hosts(play._play_hosts)
|
||||
|
||||
if play.gather_facts is None and C.DEFAULT_GATHERING == 'smart':
|
||||
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:
|
||||
return {}
|
||||
elif play.gather_facts is False or (play.gather_facts is None and C.DEFAULT_GATHERING == 'never'):
|
||||
return {}
|
||||
|
||||
self.callbacks.on_setup()
|
||||
self.inventory.restrict_to(host_list)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue