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