diff --git a/changelogs/fragments/deprecated_task_parameters.yml b/changelogs/fragments/deprecated_task_parameters.yml new file mode 100644 index 00000000000..95043144508 --- /dev/null +++ b/changelogs/fragments/deprecated_task_parameters.yml @@ -0,0 +1,2 @@ +removed_features: + - task, inline parameters being auto coerced into variables has been removed. diff --git a/lib/ansible/playbook/role/__init__.py b/lib/ansible/playbook/role/__init__.py index 267005ee927..50fbfe3ea81 100644 --- a/lib/ansible/playbook/role/__init__.py +++ b/lib/ansible/playbook/role/__init__.py @@ -197,7 +197,7 @@ class Role(Base, Conditional, Taggable, CollectionSearch): # copy over all field attributes from the RoleInclude # update self._attributes directly, to avoid squashing - for (attr_name, _) in iteritems(self._valid_attrs): + for (attr_name, dump) in iteritems(self._valid_attrs): if attr_name in ('when', 'tags'): self._attributes[attr_name] = self._extend_value( self._attributes[attr_name], diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index 2052b104f8d..b92bd1971bc 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -259,20 +259,10 @@ class Task(Base, Conditional, Taggable, CollectionSearch): elif k.startswith('with_') and k.replace("with_", "") in lookup_loader: # transform into loop property self._preprocess_with_loop(ds, new_ds, k, v) + elif C.INVALID_TASK_ATTRIBUTE_FAILED or k in self._valid_attrs: + new_ds[k] = v else: - # pre-2.0 syntax allowed variables for include statements at the top level of the task, - # so we move those into the 'vars' dictionary here, and show a deprecation message - # as we will remove this at some point in the future. - if action in C._ACTION_INCLUDE and k not in self._valid_attrs and k not in self.DEPRECATED_ATTRIBUTES: - display.deprecated("Specifying include variables at the top-level of the task is deprecated." - " Please see:\nhttps://docs.ansible.com/ansible/playbooks_roles.html#task-include-files-and-encouraging-reuse\n\n" - " for currently supported syntax regarding included files and variables", - version="2.12", collection_name='ansible.builtin') - new_ds['vars'][k] = v - elif C.INVALID_TASK_ATTRIBUTE_FAILED or k in self._valid_attrs: - new_ds[k] = v - else: - display.warning("Ignoring invalid attribute: %s" % k) + display.warning("Ignoring invalid attribute: %s" % k) return super(Task, self).preprocess_data(new_ds) diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index 97d7effd070..fb3746d09c2 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -150,8 +150,6 @@ lib/ansible/playbook/conditional.py pylint:ansible-deprecated-version lib/ansible/playbook/helpers.py pylint:ansible-deprecated-version lib/ansible/playbook/helpers.py pylint:blacklisted-name lib/ansible/playbook/play_context.py pylint:ansible-deprecated-version -lib/ansible/playbook/role/__init__.py pylint:blacklisted-name -lib/ansible/playbook/task.py pylint:ansible-deprecated-version lib/ansible/plugins/action/__init__.py pylint:ansible-deprecated-version lib/ansible/plugins/action/async_status.py pylint:ansible-deprecated-version lib/ansible/plugins/action/normal.py action-plugin-docs # default action plugin for modules without a dedicated action plugin