mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 05:12:45 +00:00
Adding 'role_path' to VariableManager "magic" variables (v2)
This commit is contained in:
@@ -212,7 +212,6 @@ class VariableManager:
|
||||
# FIXME: make sure all special vars are here
|
||||
# Finally, we create special vars
|
||||
|
||||
|
||||
if host:
|
||||
all_vars['groups'] = [group.name for group in host.get_groups()]
|
||||
|
||||
@@ -220,6 +219,10 @@ class VariableManager:
|
||||
hostvars = HostVars(vars_manager=self, inventory=self._inventory, loader=loader)
|
||||
all_vars['hostvars'] = hostvars
|
||||
|
||||
if task:
|
||||
if task._role:
|
||||
all_vars['role_path'] = task._role._role_path
|
||||
|
||||
if self._inventory is not None:
|
||||
all_vars['inventory_dir'] = self._inventory.basedir()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user