diff --git a/changelogs/fragments/command-warnings-deprecation-2.yml b/changelogs/fragments/command-warnings-deprecation-2.yml new file mode 100644 index 00000000000..e81b24cf1fd --- /dev/null +++ b/changelogs/fragments/command-warnings-deprecation-2.yml @@ -0,0 +1,2 @@ +bugfixes: + - Fix to previous deprecation change (#70504) which caused command warning deprecation to show in all cases, even when not specified by the user. diff --git a/lib/ansible/plugins/action/command.py b/lib/ansible/plugins/action/command.py index 79f1a7ff034..46fcc9b3120 100644 --- a/lib/ansible/plugins/action/command.py +++ b/lib/ansible/plugins/action/command.py @@ -17,7 +17,7 @@ class ActionModule(ActionBase): del tmp # tmp no longer has any effect # Command module has a special config option to turn off the command nanny warnings - if 'warn' not in self._task.args: + if 'warn' not in self._task.args and C.COMMAND_WARNINGS: self._task.args['warn'] = C.COMMAND_WARNINGS wrap_async = self._task.async_val and not self._connection.has_native_async