1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Additionally template args in role_include that affect role loading (#33386)

This fixes many issues with role_include by correctly templating and
saving fields which affect role loading in the args for the role include.
This commit is contained in:
James Cammarata 2017-11-30 09:52:28 -06:00 committed by Brian Coca
parent 35acae7ea7
commit 52a8644a15
2 changed files with 12 additions and 1 deletions

View file

@ -134,6 +134,17 @@ class IncludedFile:
include_file = templar.template(include_file)
inc_file = IncludedFile(include_file, include_variables, original_task)
else:
# template the included role's name here
role_name = include_variables.get('name', include_variables.get('role', None))
if role_name is not None:
role_name = templar.template(role_name)
original_task._role_name = role_name
for from_arg in original_task.FROM_ARGS:
if from_arg in include_variables:
from_key = from_arg.replace('_from', '')
original_task._from_files[from_key] = templar.template(include_variables[from_arg])
inc_file = IncludedFile("role", include_variables, original_task, is_role=True)
try:

View file

@ -198,7 +198,7 @@ class StrategyModule(StrategyBase):
new_ir = included_file._task.copy()
new_ir.vars.update(included_file._args)
new_blocks, handler_blocks = new_ir.get_block_list(
new_blocks, handler_blocks = included_file._task.get_block_list(
play=iterator._play,
variable_manager=self._variable_manager,
loader=self._loader,