When using roles, or other includes, the path to DWIM inside is the path of the task include
file.
This commit is contained in:
parent
f88d13acf9
commit
f044fc344b
2 changed files with 11 additions and 3 deletions
|
@ -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…
Reference in a new issue