Add ansible_parent_role_names magic variable (#46687)

-Add: Test cases for ansible_parent_role_names and ansible_parent_role_paths
-Add: ansible_parent_role_names/paths variables for when a role is being included by another role.
This commit is contained in:
Xaroth 2019-04-23 17:55:05 +02:00 committed by Sam Doran
parent b442706b54
commit a9f24e097f
9 changed files with 135 additions and 1 deletions

View file

@ -166,4 +166,6 @@ class IncludeRole(TaskInclude):
v = super(IncludeRole, self).get_include_params()
if self._parent_role:
v.update(self._parent_role.get_role_params())
v.setdefault('ansible_parent_role_names', []).insert(0, self._parent_role.get_name())
v.setdefault('ansible_parent_role_paths', []).insert(0, self._parent_role._role_path)
return v