Adding 'role_path' to VariableManager "magic" variables (v2)
This commit is contained in:
parent
7b1c6fbab9
commit
fd321355d6
1 changed files with 4 additions and 1 deletions
|
@ -212,7 +212,6 @@ class VariableManager:
|
||||||
# FIXME: make sure all special vars are here
|
# FIXME: make sure all special vars are here
|
||||||
# Finally, we create special vars
|
# Finally, we create special vars
|
||||||
|
|
||||||
|
|
||||||
if host:
|
if host:
|
||||||
all_vars['groups'] = [group.name for group in host.get_groups()]
|
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)
|
hostvars = HostVars(vars_manager=self, inventory=self._inventory, loader=loader)
|
||||||
all_vars['hostvars'] = hostvars
|
all_vars['hostvars'] = hostvars
|
||||||
|
|
||||||
|
if task:
|
||||||
|
if task._role:
|
||||||
|
all_vars['role_path'] = task._role._role_path
|
||||||
|
|
||||||
if self._inventory is not None:
|
if self._inventory is not None:
|
||||||
all_vars['inventory_dir'] = self._inventory.basedir()
|
all_vars['inventory_dir'] = self._inventory.basedir()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue