|
|
@ -220,9 +220,9 @@ class PlayBook(object):
|
|
|
|
elif 'skipped' in host_result:
|
|
|
|
elif 'skipped' in host_result:
|
|
|
|
self.skipped[host] = self.skipped.get(host, 0) + 1
|
|
|
|
self.skipped[host] = self.skipped.get(host, 0) + 1
|
|
|
|
self.callbacks.on_skipped(host)
|
|
|
|
self.callbacks.on_skipped(host)
|
|
|
|
if poll:
|
|
|
|
elif poll:
|
|
|
|
continue
|
|
|
|
continue
|
|
|
|
if not setup and ('changed' in host_result):
|
|
|
|
elif not setup and ('changed' in host_result):
|
|
|
|
self.invocations[host] = self.invocations.get(host, 0) + 1
|
|
|
|
self.invocations[host] = self.invocations.get(host, 0) + 1
|
|
|
|
self.changed[host] = self.changed.get(host, 0) + 1
|
|
|
|
self.changed[host] = self.changed.get(host, 0) + 1
|
|
|
|
self.callbacks.on_ok(host, host_result)
|
|
|
|
self.callbacks.on_ok(host, host_result)
|
|
|
@ -402,30 +402,23 @@ class PlayBook(object):
|
|
|
|
|
|
|
|
|
|
|
|
# *****************************************************
|
|
|
|
# *****************************************************
|
|
|
|
|
|
|
|
|
|
|
|
def _do_setup_step(self, pattern, vars, user, host_list, vars_files=None):
|
|
|
|
def _do_conditional_imports(self, vars_files, host_list):
|
|
|
|
''' push variables down to the systems and get variables+facts back up '''
|
|
|
|
''' handle the vars_files section, which can contain variables '''
|
|
|
|
|
|
|
|
|
|
|
|
# this enables conditional includes like $facter_os.yml and is only done
|
|
|
|
|
|
|
|
# after the original pass when we have that data.
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# FIXME: refactor into subfunction
|
|
|
|
|
|
|
|
# FIXME: save parsed variable results in memory to avoid excessive re-reading/parsing
|
|
|
|
# FIXME: save parsed variable results in memory to avoid excessive re-reading/parsing
|
|
|
|
# FIXME: currently parses imports for hosts not in the pattern, that is not wrong, but it's
|
|
|
|
# FIXME: currently parses imports for hosts not in the pattern, that is not wrong, but it's
|
|
|
|
# not super optimized yet either, because we wouldn't have hit them, ergo
|
|
|
|
# not super optimized yet either, because we wouldn't have hit them, ergo
|
|
|
|
# it will raise false errors if there is no defaults variable file without any $vars
|
|
|
|
# it will raise false errors if there is no defaults variable file without any $vars
|
|
|
|
# in it, which could happen on uncontacted hosts.
|
|
|
|
# in it, which could happen on uncontacted hosts.
|
|
|
|
|
|
|
|
|
|
|
|
if vars_files is not None:
|
|
|
|
|
|
|
|
if type(vars_files) != list:
|
|
|
|
if type(vars_files) != list:
|
|
|
|
raise errors.AnsibleError("vars_files must be a list")
|
|
|
|
raise errors.AnsibleError("vars_files must be a list")
|
|
|
|
self.callbacks.on_setup_secondary()
|
|
|
|
|
|
|
|
for host in host_list:
|
|
|
|
for host in host_list:
|
|
|
|
cache_vars = SETUP_CACHE.get(host,{})
|
|
|
|
cache_vars = SETUP_CACHE.get(host,{})
|
|
|
|
SETUP_CACHE[host] = {}
|
|
|
|
SETUP_CACHE[host] = {}
|
|
|
|
for filename in vars_files:
|
|
|
|
for filename in vars_files:
|
|
|
|
if type(filename) == list:
|
|
|
|
if type(filename) == list:
|
|
|
|
# loop over all filenames, loading the first one, and failing if
|
|
|
|
# loop over all filenames, loading the first one, and failing if # none found
|
|
|
|
# none found
|
|
|
|
|
|
|
|
found = False
|
|
|
|
found = False
|
|
|
|
sequence = []
|
|
|
|
sequence = []
|
|
|
|
for real_filename in filename:
|
|
|
|
for real_filename in filename:
|
|
|
@ -451,6 +444,19 @@ class PlayBook(object):
|
|
|
|
data = utils.parse_yaml_from_file(filename2)
|
|
|
|
data = utils.parse_yaml_from_file(filename2)
|
|
|
|
SETUP_CACHE[host].update(data)
|
|
|
|
SETUP_CACHE[host].update(data)
|
|
|
|
self.callbacks.on_import_for_host(host, filename2)
|
|
|
|
self.callbacks.on_import_for_host(host, filename2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# *****************************************************
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _do_setup_step(self, pattern, vars, user, host_list, vars_files=None):
|
|
|
|
|
|
|
|
''' push variables down to the systems and get variables+facts back up '''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# this enables conditional includes like $facter_os.yml and is only done
|
|
|
|
|
|
|
|
# after the original pass when we have that data.
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if vars_files is not None:
|
|
|
|
|
|
|
|
self.callbacks.on_setup_secondary()
|
|
|
|
|
|
|
|
self._do_conditional_imports(vars_files, host_list)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self.callbacks.on_setup_primary()
|
|
|
|
self.callbacks.on_setup_primary()
|
|
|
|
|
|
|
|
|
|
|
|