From ec984f933983a5494f05e9ca41ab2edd095acec3 Mon Sep 17 00:00:00 2001 From: Maksim Kramarenko Date: Mon, 26 Aug 2024 02:08:58 +0200 Subject: [PATCH] Fix-69882-issue --- lib/ansible/playbook/helpers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/playbook/helpers.py b/lib/ansible/playbook/helpers.py index f0ef498d19f..acedc321d59 100644 --- a/lib/ansible/playbook/helpers.py +++ b/lib/ansible/playbook/helpers.py @@ -169,7 +169,11 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h parent_include = parent_include._parent continue try: - parent_include_dir = os.path.dirname(templar.template(parent_include.args.get('_raw_params'))) + if isinstance(parent_include, IncludeRole): + task_path = os.path.join(parent_include._role_path, 'tasks') + else: + task_path = parent_include.args.get('_raw_params') + parent_include_dir = os.path.dirname(templar.template(task_path)) except AnsibleUndefinedVariable as e: if not parent_include.statically_loaded: raise AnsibleParserError(