Fix some items related to playbook includes and indentation.

pull/2646/head
Michael DeHaan 12 years ago
parent 290780d13f
commit c5d9823467

@ -223,7 +223,7 @@ Tagged Releases
Tarballs of releases are available on the ansible.cc page. Tarballs of releases are available on the ansible.cc page.
* `Ansible/downloads <https://ansible.cc/releases>`_ * `Ansible/downloads <http://ansible.cc/releases>`_
These releases are also tagged in the git repository with the release version. These releases are also tagged in the git repository with the release version.

@ -175,20 +175,23 @@ class PlayBook(object):
(k,v) = t.split("=", 1) (k,v) = t.split("=", 1)
incvars[k] = utils.template(basedir, v, incvars) incvars[k] = utils.template(basedir, v, incvars)
included_path = utils.path_dwim(basedir, utils.template(basedir, tokens[0], incvars))
(plays, basedirs) = self._load_playbook_from_file(included_path, incvars) included_path = utils.path_dwim(basedir, utils.template(basedir, tokens[0], incvars))
for p in plays: (plays, basedirs) = self._load_playbook_from_file(included_path, incvars)
# support for parameterized play includes works by passing for p in plays:
# those variables along to the subservient play # support for parameterized play includes works by passing
if 'vars' not in p: # those variables along to the subservient play
p['vars'] = {} if 'vars' not in p:
if isinstance(p['vars'], dict): p['vars'] = {}
p['vars'].update(incvars) if isinstance(p['vars'], dict):
elif isinstance(p['vars'], list): p['vars'].update(incvars)
# nobody should really do this, but handle vars: a=1 b=2 elif isinstance(p['vars'], list):
p['vars'].extend([dict(k=v) for k,v in incvars.iteritems()]) # nobody should really do this, but handle vars: a=1 b=2
accumulated_plays.extend(plays) p['vars'].extend([dict(k=v) for k,v in incvars.iteritems()])
play_basedirs.extend(basedirs)
accumulated_plays.extend(plays)
play_basedirs.extend(basedirs)
else: else:
# this is a normal (non-included play) # this is a normal (non-included play)

Loading…
Cancel
Save