From 202195f5e4d048967f79b74319bccb08924bfb1c Mon Sep 17 00:00:00 2001 From: Martin Krizek Date: Mon, 22 May 2023 16:09:47 +0200 Subject: [PATCH] Remove unreachable error for removed include_role.static (#80837) --- .../remove-unreachable-include_role-static-err.yml | 2 ++ lib/ansible/playbook/helpers.py | 11 +---------- 2 files changed, 3 insertions(+), 10 deletions(-) create mode 100644 changelogs/fragments/remove-unreachable-include_role-static-err.yml diff --git a/changelogs/fragments/remove-unreachable-include_role-static-err.yml b/changelogs/fragments/remove-unreachable-include_role-static-err.yml new file mode 100644 index 00000000000..2c1749de317 --- /dev/null +++ b/changelogs/fragments/remove-unreachable-include_role-static-err.yml @@ -0,0 +1,2 @@ +bugfixes: + - Remove unreachable parser error for removed ``static`` parameter of ``include_role`` diff --git a/lib/ansible/playbook/helpers.py b/lib/ansible/playbook/helpers.py index 6baab37aadd..ccc46bf6726 100644 --- a/lib/ansible/playbook/helpers.py +++ b/lib/ansible/playbook/helpers.py @@ -274,18 +274,9 @@ def load_list_of_tasks(ds, play, block=None, role=None, task_include=None, use_h loader=loader, ) - # 1. the user has set the 'static' option to false or true - # 2. one of the appropriate config options was set - is_static = False if action in C._ACTION_IMPORT_ROLE: - is_static = True - - if is_static: if ir.loop is not None: - if action in C._ACTION_IMPORT_ROLE: - raise AnsibleParserError("You cannot use loops on 'import_role' statements. You should use 'include_role' instead.", obj=task_ds) - else: - raise AnsibleParserError("You cannot use 'static' on an include_role with a loop", obj=task_ds) + raise AnsibleParserError("You cannot use loops on 'import_role' statements. You should use 'include_role' instead.", obj=task_ds) # we set a flag to indicate this include was static ir.statically_loaded = True