mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-04 05:04:22 -07:00
Make it possible to use variables from 'vars' in the paths to task level include statements.
This commit is contained in:
parent
43b3a0be97
commit
e4a546e8bb
1 changed files with 1 additions and 3 deletions
|
@ -39,7 +39,6 @@ class Play(object):
|
||||||
|
|
||||||
# TODO: more error handling
|
# TODO: more error handling
|
||||||
|
|
||||||
|
|
||||||
hosts = ds.get('hosts')
|
hosts = ds.get('hosts')
|
||||||
if hosts is None:
|
if hosts is None:
|
||||||
raise errors.AnsibleError('hosts declaration is required')
|
raise errors.AnsibleError('hosts declaration is required')
|
||||||
|
@ -80,7 +79,6 @@ 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):
|
||||||
|
@ -96,7 +94,7 @@ class Play(object):
|
||||||
for t in tokens[1:]:
|
for t in tokens[1:]:
|
||||||
(k,v) = t.split("=", 1)
|
(k,v) = t.split("=", 1)
|
||||||
task_vars[k]=v
|
task_vars[k]=v
|
||||||
include_file = tokens[0]
|
include_file = utils.template(tokens[0], task_vars)
|
||||||
data = utils.parse_yaml_from_file(utils.path_dwim(self.playbook.basedir, include_file))
|
data = utils.parse_yaml_from_file(utils.path_dwim(self.playbook.basedir, include_file))
|
||||||
elif type(x) == dict:
|
elif type(x) == dict:
|
||||||
data = [x]
|
data = [x]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue