|
|
@ -63,6 +63,9 @@ class Play(object):
|
|
|
|
self.sudo_user = ds.get('sudo_user', self.playbook.sudo_user)
|
|
|
|
self.sudo_user = ds.get('sudo_user', self.playbook.sudo_user)
|
|
|
|
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._update_vars_files_for_host(None)
|
|
|
|
|
|
|
|
|
|
|
|
self._tasks = self._load_tasks(self._ds, 'tasks')
|
|
|
|
self._tasks = self._load_tasks(self._ds, 'tasks')
|
|
|
|
self._handlers = self._load_tasks(self._ds, 'handlers')
|
|
|
|
self._handlers = self._load_tasks(self._ds, 'handlers')
|
|
|
|
|
|
|
|
|
|
|
@ -76,6 +79,7 @@ class Play(object):
|
|
|
|
if self.sudo_user != 'root':
|
|
|
|
if self.sudo_user != 'root':
|
|
|
|
self.sudo = True
|
|
|
|
self.sudo = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# *************************************************
|
|
|
|
# *************************************************
|
|
|
|
|
|
|
|
|
|
|
|
def _load_tasks(self, ds, keyname):
|
|
|
|
def _load_tasks(self, ds, keyname):
|
|
|
@ -104,6 +108,10 @@ class Play(object):
|
|
|
|
elif isinstance(items, basestring):
|
|
|
|
elif isinstance(items, basestring):
|
|
|
|
items = utils.varLookup(items, task_vars)
|
|
|
|
items = utils.varLookup(items, task_vars)
|
|
|
|
for item in items:
|
|
|
|
for item in items:
|
|
|
|
|
|
|
|
item = utils.template(item, task_vars)
|
|
|
|
|
|
|
|
if self._has_vars_in(item):
|
|
|
|
|
|
|
|
raise errors.AnsibleError("parse error: unbound variable in with_items: %s" % item)
|
|
|
|
|
|
|
|
|
|
|
|
mv = task_vars.copy()
|
|
|
|
mv = task_vars.copy()
|
|
|
|
mv['item'] = item
|
|
|
|
mv['item'] = item
|
|
|
|
results.append(Task(self,y,module_vars=mv))
|
|
|
|
results.append(Task(self,y,module_vars=mv))
|
|
|
@ -161,10 +169,6 @@ class Play(object):
|
|
|
|
def update_vars_files(self, hosts):
|
|
|
|
def update_vars_files(self, hosts):
|
|
|
|
''' calculate vars_files, which requires that setup runs first so ansible facts can be mixed in '''
|
|
|
|
''' calculate vars_files, which requires that setup runs first so ansible facts can be mixed in '''
|
|
|
|
|
|
|
|
|
|
|
|
# first process things that are not really host specific
|
|
|
|
|
|
|
|
# and we can just keep one reference to them
|
|
|
|
|
|
|
|
self._update_vars_files_for_host(None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# now loop through all the hosts...
|
|
|
|
# now loop through all the hosts...
|
|
|
|
for h in hosts:
|
|
|
|
for h in hosts:
|
|
|
|
self._update_vars_files_for_host(h)
|
|
|
|
self._update_vars_files_for_host(h)
|
|
|
|