mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-05 07:54:00 -07:00
Fix conditional inheritance on dynamic includes (tasks and roles) (#30178)
Per the new style of execution, for dynamic tasks conditionals are expected to only affect the include task itself and should not be inherited by child tasks. This patch brings the behavior inline with this expectation. Fixes #27845
This commit is contained in:
parent
b2ac60cfd7
commit
b38f746604
3 changed files with 32 additions and 10 deletions
|
@ -279,6 +279,7 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h
|
|||
else:
|
||||
task_list.extend(included_blocks)
|
||||
else:
|
||||
t.is_static = False
|
||||
task_list.append(t)
|
||||
|
||||
elif 'include_role' in task_ds or 'import_role' in task_ds:
|
||||
|
@ -319,6 +320,9 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h
|
|||
display.debug('Determined that if include_role static is %s' % str(is_static))
|
||||
|
||||
if is_static:
|
||||
# we set a flag to indicate this include was static
|
||||
ir.statically_loaded = True
|
||||
|
||||
# uses compiled list from object
|
||||
blocks, _ = ir.get_block_list(variable_manager=variable_manager, loader=loader)
|
||||
t = task_list.extend(blocks)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue