|
|
|
@ -133,23 +133,17 @@ class PlayBook(object):
|
|
|
|
accumulated_plays = []
|
|
|
|
accumulated_plays = []
|
|
|
|
|
|
|
|
|
|
|
|
if type(playbook_data) != list:
|
|
|
|
if type(playbook_data) != list:
|
|
|
|
raise errors.AnsibleError(
|
|
|
|
raise errors.AnsibleError("parse error: playbooks must be formatted as a YAML list")
|
|
|
|
"parse error: playbooks must be formatted as a YAML list"
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for play in playbook_data:
|
|
|
|
for play in playbook_data:
|
|
|
|
if type(play) != dict:
|
|
|
|
if type(play) != dict:
|
|
|
|
raise errors.AnsibleError(
|
|
|
|
raise errors.AnsibleError("parse error: each play in a playbook must a YAML dictionary (hash), recieved: %s" % play)
|
|
|
|
"parse error: each play in a playbook must a YAML dictionary (hash), recieved: %s" % play
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
if 'include' in play:
|
|
|
|
if 'include' in play:
|
|
|
|
if len(play.keys()) == 1:
|
|
|
|
if len(play.keys()) == 1:
|
|
|
|
included_path = utils.path_dwim(self.basedir, play['include'])
|
|
|
|
included_path = utils.path_dwim(self.basedir, play['include'])
|
|
|
|
accumulated_plays.extend(self._load_playbook_from_file(included_path))
|
|
|
|
accumulated_plays.extend(self._load_playbook_from_file(included_path))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
raise errors.AnsibleError(
|
|
|
|
raise errors.AnsibleError("parse error: top level includes cannot be used with other directives: %s" % play)
|
|
|
|
"parse error: top level includes cannot be used with other directives: %s" % play
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
accumulated_plays.append(play)
|
|
|
|
accumulated_plays.append(play)
|
|
|
|
|
|
|
|
|
|
|
|
|