When using roles, or other includes, the path to DWIM inside is the path of the task include

file.
pull/2592/head
Michael DeHaan 11 years ago
parent f88d13acf9
commit f044fc344b

@ -3,4 +3,8 @@
- name: blippy
shell: echo notifier called, and the value of x is '{{ x }}'
# within a role, it's possible to include other task files as well. By default, we
# can reference files in the same directory without doing anything special:
- include: other.yml

@ -223,9 +223,13 @@ class Play(object):
for t in tokens[1:]:
(k,v) = t.split("=", 1)
mv[k] = utils.template(self.basedir, v, mv)
include_file = utils.template(self.basedir, tokens[0], mv)
data = utils.parse_yaml_from_file(utils.path_dwim(self.basedir, include_file))
results += self._load_tasks(data, mv, included_additional_conditions, original_file=include_file)
dirname = self.basedir
if original_file:
dirname = os.path.dirname(original_file)
include_file = utils.template(dirname, tokens[0], mv)
include_filename = utils.path_dwim(dirname, include_file)
data = utils.parse_yaml_from_file(include_filename)
results += self._load_tasks(data, mv, included_additional_conditions, original_file=include_filename)
elif type(x) == dict:
results.append(Task(self,x,module_vars=task_vars, additional_conditions=additional_conditions))
else:

Loading…
Cancel
Save