Fix nested import_tasks when the parent import contains a template (#85599)

* Test nested import_tasks when the parent import contains a template

* Fix templating the parent_include.args
This commit is contained in:
Sloane Hertel
2025-08-08 15:51:00 -04:00
committed by GitHub
parent 4c04b8c7c3
commit 9a6420e1d5
5 changed files with 6 additions and 0 deletions
@@ -0,0 +1,2 @@
bugfixes:
- import_tasks - fix templating parent include arguments.
+1
View File
@@ -169,6 +169,7 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h
if not isinstance(parent_include, TaskInclude):
parent_include = parent_include._parent
continue
parent_include.post_validate(templar=templar)
parent_include_dir = os.path.dirname(parent_include.args.get('_raw_params'))
if cumulative_path is None:
cumulative_path = parent_include_dir
@@ -9,3 +9,5 @@
- assert:
that:
- nested_adjacent_count|int == 2
- import_tasks: "{{ role_path }}/tests/main.yml"
@@ -0,0 +1 @@
- import_tasks: tests_relative.yml