|
|
@ -47,15 +47,16 @@ class PlayBook(object):
|
|
|
|
# *****************************************************
|
|
|
|
# *****************************************************
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self,
|
|
|
|
def __init__(self,
|
|
|
|
playbook =None,
|
|
|
|
playbook = None,
|
|
|
|
host_list =C.DEFAULT_HOST_LIST,
|
|
|
|
host_list = C.DEFAULT_HOST_LIST,
|
|
|
|
module_path =C.DEFAULT_MODULE_PATH,
|
|
|
|
module_path = C.DEFAULT_MODULE_PATH,
|
|
|
|
forks =C.DEFAULT_FORKS,
|
|
|
|
forks = C.DEFAULT_FORKS,
|
|
|
|
timeout =C.DEFAULT_TIMEOUT,
|
|
|
|
timeout = C.DEFAULT_TIMEOUT,
|
|
|
|
remote_user =C.DEFAULT_REMOTE_USER,
|
|
|
|
remote_user = C.DEFAULT_REMOTE_USER,
|
|
|
|
remote_pass =C.DEFAULT_REMOTE_PASS,
|
|
|
|
remote_pass = C.DEFAULT_REMOTE_PASS,
|
|
|
|
verbose=False,
|
|
|
|
override_hosts = None,
|
|
|
|
callbacks=None):
|
|
|
|
verbose = False,
|
|
|
|
|
|
|
|
callbacks = None):
|
|
|
|
|
|
|
|
|
|
|
|
self.host_list = host_list
|
|
|
|
self.host_list = host_list
|
|
|
|
self.module_path = module_path
|
|
|
|
self.module_path = module_path
|
|
|
@ -65,6 +66,7 @@ class PlayBook(object):
|
|
|
|
self.remote_pass = remote_pass
|
|
|
|
self.remote_pass = remote_pass
|
|
|
|
self.verbose = verbose
|
|
|
|
self.verbose = verbose
|
|
|
|
self.callbacks = callbacks
|
|
|
|
self.callbacks = callbacks
|
|
|
|
|
|
|
|
self.override_hosts = override_hosts
|
|
|
|
self.callbacks.set_playbook(self)
|
|
|
|
self.callbacks.set_playbook(self)
|
|
|
|
|
|
|
|
|
|
|
|
# store the list of changes/invocations/failure counts
|
|
|
|
# store the list of changes/invocations/failure counts
|
|
|
@ -83,7 +85,8 @@ class PlayBook(object):
|
|
|
|
self.basedir = os.path.dirname(playbook)
|
|
|
|
self.basedir = os.path.dirname(playbook)
|
|
|
|
self.playbook = self._parse_playbook(playbook)
|
|
|
|
self.playbook = self._parse_playbook(playbook)
|
|
|
|
|
|
|
|
|
|
|
|
self.host_list, self.groups = ansible.runner.Runner.parse_hosts(host_list)
|
|
|
|
self.host_list, self.groups = ansible.runner.Runner.parse_hosts(
|
|
|
|
|
|
|
|
host_list, override_hosts=self.override_hosts)
|
|
|
|
|
|
|
|
|
|
|
|
# *****************************************************
|
|
|
|
# *****************************************************
|
|
|
|
|
|
|
|
|
|
|
@ -499,7 +502,11 @@ class PlayBook(object):
|
|
|
|
''' run a list of tasks for a given pattern, in order '''
|
|
|
|
''' run a list of tasks for a given pattern, in order '''
|
|
|
|
|
|
|
|
|
|
|
|
# get configuration information about the pattern
|
|
|
|
# get configuration information about the pattern
|
|
|
|
pattern = pg['hosts']
|
|
|
|
pattern = pg.get('hosts',None)
|
|
|
|
|
|
|
|
if self.override_hosts:
|
|
|
|
|
|
|
|
pattern = 'all'
|
|
|
|
|
|
|
|
if pattern is None:
|
|
|
|
|
|
|
|
raise errors.AnsibleError('hosts declaration is required')
|
|
|
|
|
|
|
|
|
|
|
|
vars = self._get_vars(pg, self.basedir)
|
|
|
|
vars = self._get_vars(pg, self.basedir)
|
|
|
|
vars_files = pg.get('vars_files', {})
|
|
|
|
vars_files = pg.get('vars_files', {})
|
|
|
|