diff --git a/changelogs/fragments/74144-remove-include-vartags.yml b/changelogs/fragments/74144-remove-include-vartags.yml new file mode 100644 index 00000000000..116de9183f7 --- /dev/null +++ b/changelogs/fragments/74144-remove-include-vartags.yml @@ -0,0 +1,3 @@ +bugfixes: +- includes - Remove the deprecated ability to specify ``tags`` as ``vars`` on includes + (https://github.com/ansible/ansible/issues/74144) diff --git a/lib/ansible/plugins/strategy/__init__.py b/lib/ansible/plugins/strategy/__init__.py index 1bfe04e47cf..90f7cbc19d7 100644 --- a/lib/ansible/plugins/strategy/__init__.py +++ b/lib/ansible/plugins/strategy/__init__.py @@ -922,20 +922,6 @@ class StrategyBase: raise AnsibleError("included task files must contain a list of tasks") ti_copy = self._copy_included_file(included_file) - # pop tags out of the include args, if they were specified there, and assign - # them to the include. If the include already had tags specified, we raise an - # error so that users know not to specify them both ways - tags = included_file._task.vars.pop('tags', []) - if isinstance(tags, string_types): - tags = tags.split(',') - if len(tags) > 0: - if len(included_file._task.tags) > 0: - raise AnsibleParserError("Include tasks should not specify tags in more than one way (both via args and directly on the task). " - "Mixing tag specify styles is prohibited for whole import hierarchy, not only for single import statement", - obj=included_file._task._ds) - display.deprecated("You should not specify tags in the include parameters. All tags should be specified using the task-level option", - version='2.12', collection_name='ansible.builtin') - included_file._task.tags = tags block_list = load_list_of_blocks( data, diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index 9119a2316da..baaed595d0c 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -123,7 +123,6 @@ lib/ansible/plugins/action/normal.py action-plugin-docs # default action plugin lib/ansible/plugins/cache/base.py ansible-doc!skip # not a plugin, but a stub for backwards compatibility lib/ansible/plugins/inventory/script.py pylint:ansible-deprecated-version lib/ansible/plugins/lookup/sequence.py pylint:blacklisted-name -lib/ansible/plugins/strategy/__init__.py pylint:ansible-deprecated-version lib/ansible/plugins/strategy/__init__.py pylint:blacklisted-name lib/ansible/plugins/strategy/linear.py pylint:blacklisted-name lib/ansible/vars/hostvars.py pylint:blacklisted-name