mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
Added examples of how roles work!
This commit is contained in:
parent
892484812e
commit
f308194b9a
8 changed files with 72 additions and 2 deletions
|
@ -127,11 +127,13 @@ class Play(object):
|
|||
new_vars_files = []
|
||||
for orig_path in roles:
|
||||
path = utils.path_dwim(self.basedir, orig_path)
|
||||
if not os.path.isdir(path):
|
||||
path2 = utils.path_dwim(self.basedir, os.path.join(self.basedir, 'roles', orig_path))
|
||||
if not os.path.isdir(path) and not orig_path.startswith(".") and not orig_path.startswith("/"):
|
||||
path2 = utils.path_dwim(self.basedir, os.path.join('roles', orig_path))
|
||||
if not os.path.isdir(path2):
|
||||
raise errors.AnsibleError("cannot find role in %s or %s" % (path, path2))
|
||||
path = path2
|
||||
elif not os.path.isdir(path):
|
||||
raise errors.AnsibleError("cannot find role in %s" % (path))
|
||||
task = utils.path_dwim(self.basedir, os.path.join(path, 'tasks', 'main.yml'))
|
||||
handler = utils.path_dwim(self.basedir, os.path.join(path, 'handlers', 'main.yml'))
|
||||
vars_file = utils.path_dwim(self.basedir, os.path.join(path, 'vars', 'main.yml'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue