Back to Ansible

ansible-core 2.21 "The Rain Song" Release Notes

changelogs/CHANGELOG-v2.21.rst

2.21.0b329.7 KB
Original Source

=============================================== ansible-core 2.21 "The Rain Song" Release Notes

.. contents:: Topics

v2.21.0b3

Release Summary

| Release Date: 2026-04-21 | Porting Guide <https://docs.ansible.com/ansible-core/2.21/porting_guides/porting_guide_core_2.21.html>__

Minor Changes

  • task results - Python and Powershell modules do not include the invocation task result key by default. Injection of the invocation task result key for Python and Powershell modules may be enabled with the var-settable INJECT_INVOCATION config item. Most callbacks mask invocation when displaying a task or loop item result.
  • worker process - When controller and forked child workers must share a TTY, the WORKER_SESSION_ISOLATION config item can be set to false (via variable/config/envvar) to disable forked worker session isolation.

Deprecated Features

  • task result - Inferred task failure from a non-zero rc key and absence of a failed key will be deprecated in Ansible Core 2.22. Actions and modules must explicitly communicate failure by setting the failed key, using APIs that do so, or raising an unhandled exception. In future releases, the rc key will receive no special handling during task result processing.

Bugfixes

  • ansible-test remote alias - Alias values for --controller and --target are properly resolved for remote. Previously, remote alias values (e.g. fedora/latest) resolved to the correct name only for the legacy --remote arg, failing with an unknown image error for the newer args.
  • task results - The invocation item result key omitted from registered values for looped task results, unless enabled via INJECT_INVOCATION. Previously, it was deleted from registered non-loop results and only available to callbacks.

v2.21.0b2

Release Summary

| Release Date: 2026-04-13 | Porting Guide <https://docs.ansible.com/ansible-core/2.21/porting_guides/porting_guide_core_2.21.html>__

Minor Changes

  • ansible-test - Generate dist_info when running tests.
  • ansible-test - Upgrade the distro-specific test containers.

Bugfixes

  • Fix validate_argspec when tags are defined on the play. The always tag is only added if the play has no tags.
  • --start-at-task - fix starting at the requested task instead of starting at the next block or play. Play level tasks run first. (https://github.com/ansible/ansible/issues/86268)

v2.21.0b1

Release Summary

| Release Date: 2026-04-06 | Porting Guide <https://docs.ansible.com/ansible-core/2.21/porting_guides/porting_guide_core_2.21.html>__

Major Changes

  • ansible-galaxy install and ansible-galaxy collection install|download - collections that declare a requires_ansible version that is not compatible with the running ansible-core version are now excluded from installation and download by default. In previous versions, ansible-galaxy would install such collections even if doing so resulted in an error at load time. To restore the previous behavior, set COLLECTIONS_ON_ANSIBLE_VERSION_MISMATCH to ignore in your configuration. (https://github.com/ansible/ansible/issues/78539)
  • action plugins - Actions can directly register variables at several precedence layers using the register_host_variables method on ActionBase. Previously, variable registration could only be simulated by user action plugins by returning ansible_facts with insecure fact injection.
  • register projections - The register task keyword allows mapping multiple variable names to Jinja expressions to transform task results and other variables. The mapping form can replace many usages of set_fact and allows order-independent chained access to other variable expressions within the same task.
  • task implicit object - A new _task implicit object is available for use in register and task conditional expressions (e.g., failed_when). The result of the current task can be accessed via the _task.result property, without the use of register. Under a loop, _task.result is the most recently completed result and _task.loop_result provides access to accumulated loop results. The _task.polymorphic_result property provides compatibility with classic name-only register in loops. The value is the result of the most recent loop iteration, then becomes the final list loop result once the loop is complete.

Minor Changes

  • DataLoader - Update DataLoader to deal exclusively in str
  • PowerShell 7 - Add support for running PowerShell written modules on POSIX hosts. PowerShell modules run with the pwsh interpreter and can access the same module utils that Windows PowerShell modules can use. Some PowerShell based module utils may not be compatible due to their reliance on Windows APIs but Ansible.Basic.cs for module input and output handling works.
  • PowerShell AddType Util - Will only include the debug information when DISPLAY_TRACEBACK contains error or always. In the past the debug information would have been included if -vvv or higher was used but this new behavior aligns the logic with the new option added in Ansible 2.19.
  • The minimum required setuptools version is now 77.0.3, as it is needed for the new PEP 639 license format
  • ansiballz - Add tech preview to embed arbitrary files, not relying on python import
  • ansible-playbook - consolidated block and task loading code to remove duplicated logic (https://github.com/ansible/ansible/pull/86603).
  • ansible-test - Add PowerShell support to managed containers and remotes.
  • ansible-test - Add container/remote aliases for more loosely specifying managed test environments.
  • ansible-test - Add limited RHEL8 integration test remote supporting Python 3.12 only
  • ansible-test - Add support for using the Ansible Core CI service from GitHub Actions.
  • ansible-test - Expand functions covered by the unwanted rule for the pylint sanity test. It now includes various os.* and subprocess.* subprocess functions in Ansible modules and module_utils.
  • ansible-test - Optimize DNF configuration for managed remote RHEL instances.
  • ansible-test - Remove use-run-command-not-popen and use-run-command-not-os-call error codes from the validate-modules sanity test. These scenarios are now covered by the pylint sanity test.
  • ansible-test - Remove pylint check for urllib2 usage.
  • ansible-test - Remove support for an obsolete remote authentication method.
  • ansible-test - Replace Alpine 3.22 container and remote with 3.23.
  • ansible-test - Replace Fedora 42 with 43.
  • ansible-test - Replace FreeBSD 13.5 remote with 15.0.
  • ansible-test - Replace FreeBSD 14.3 remote with 14.4.
  • ansible-test - Replace RHEL 10.0 remote with 10.1.
  • ansible-test - Replace RHEL 9.6 remote with 9.7.
  • ansible-test - Replace macOS 15.3 remote with macOS 26.3.
  • ansible-test - Replace the parallels managed macOS provider with a new mac provider.
  • ansible-test - Support automatic loading of test collections in core integration tests.
  • ansible-test - Switch managed macOS remotes from x86_64 to aarch64.
  • ansible-test - Update URL used to download FreeBSD wheels for managed remotes.
  • ansible-test - Update ansible-test-utility-container.
  • ansible-test - Update base and default containers.
  • ansible-test - Update http-test-container.
  • ansible-test - Update pypi-test-container.
  • ansible-test - Update sanity test requirements.
  • ansible-test - Update the pylint sanity test to pylint 4.0.2.
  • ansible-test - Use the new API endpoint for the Ansible Core CI service.
  • ansible-test - add .winrm and .networking as valid JSON/YAML inventory file extensions. This should not affect any public facing code as it is used internally for inventories generated by ansible-test.
  • ansible-test - update galaxy_ng container to current version deployed to galaxy.ansible.com
  • ansible-test acme cloud plugin - update to the 2.4.0 ACME test image, which upgrades Pebble to 2.10.0, Go to 1.26, and Python to 3.14, and generally updates all contained Python dependencies (https://github.com/ansible/ansible/pull/86740).
  • ansible-test validate-modules sanity test - now reports bad return value keys that cannot be used with the dot notation in Jinja expressions (https://github.com/ansible/ansible/issues/86079).
  • ansible-vault - improved error messages for better clarity and context when vault operations fail, helping users diagnose configuration or file access issues more easily (https://github.com/ansible/ansible/pull/86602).
  • ansible-vault - keep the original contents when the EDITOR returns failure when using ansible-vault edit.
  • break_when - A break_when_result key is always present in results when a break_when expression is used.
  • break_when - A break_when_suppressed_exception key is added to a result when a break_when expression fails and masks an existing exception in a result.
  • break_when - A failed break_when expression now preserves the loop structure of a result and any loop item results.
  • callback - filter key starting with ansible from debug messages (https://github.com/ansible/ansible/issues/69731).
  • callback plugins - support configuration using extra variables.
  • changed_when - A changed_when_result key is always present in results when a changed_when expression is used.
  • changed_when - A changed_when_suppressed_exception key is added to a result when a changed_when expression fails and masks an existing exception in a result.
  • core - The ActionBase._low_level_execute_command method no longer adds && sleep 0 to commands. This was a work-around for a 10+ year old Linux kernel bug affecting OpenSSH. By August of 2016 the fix had been included in kernel versions 4.1.26, 4.4.12, 4.5.6, 4.6.1 and 4.7. Linux kernel bug report: https://lore.kernel.org/lkml/[email protected]/ OpenSSH bug report: https://bugzilla.mindrot.org/show_bug.cgi?id=2492
  • deb822_repository - add include and exclude parameter arguments (https://github.com/ansible/ansible/issues/86155)
  • default callback - add display_included_hosts option to control the included: banner lines for include_tasks/include_role (https://github.com/ansible/ansible/issues/84499).
  • default callback plugin - add option to configure line width for YAML output. This allows to disable line wrapping (https://github.com/ansible/ansible/issues/84657, https://github.com/ansible/ansible/pull/85498).
  • default callback plugin - add variable configuration for display_skipped_hosts (https://github.com/ansible/ansible/issues/84469).
  • display - replace few words with more inclusive word list such as denylist, FilterDenyList (https://github.com/ansible/ansible/pull/86304).
  • dnf - Separate module into module and utility script
  • executor - remove unused RETURN_VARS
  • file - return disk_usage_bytes fact (https://github.com/ansible/ansible/issues/70834).
  • filter - Use datetime.strftime instead of time.strftime in strftime (https://github.com/ansible/ansible/issues/86260).
  • find - add locale encoding in err msg when none is given
  • generator - add support for extra vars (https://github.com/ansible/ansible/issues/83270).
  • group - Add warning message when invalid priority values are provided to Group.set_priority() method (https://github.com/ansible/ansible/pull/85468).
  • ignore_errors - Invalid values for ignore_errors will always be treated as False
  • ignore_errors - Templated values for the ignore_errors keyword behave more consistently in looped tasks. If ignore_errors resolves True for any loop item, errors will be ignored for the entire task.
  • ignore_unreachable - Templated values for the ignore_unreachable keyword behave more consistently in looped tasks. If ignore_unreachable resolves True for any loop item, unreachable hosts will be ignored for the entire task.
  • include_role has new option rescuable to allow it to toggle between task failure and syntax errors.
  • loops - The break_when keyword is now validated when the value is falsey.
  • loops - The registered result of a loop task no longer contains the skipped key when it would be False.
  • module/action results - A results key returned from an action or module is always preserved. Previously the results key was sometimes removed, depending on the type of its value.
  • package_facts - Switch from rpm python to rpm CLI to list packages
  • package_facts - use apk query instead of apk info for gathering package facts in Alpine (https://github.com/ansible/ansible/issues/86579).
  • password hashing - Add support back for using the crypt implementation from the C library used to build Python, or with expanded functionality using libxcrypt
  • psrp - Added the certificate_key_password option through the variable ansible_psrp_certificate_key_password that can be used to decrypt the key specified by certificate_key_pem. This option requires pypsrp>=0.9.0 to be installed in the Ansible environment.
  • psrp - Added the no_profile option through the variable ansible_psrp_no_profile that can stop the remote Windows host from loading the user profile on the Ansible tasks. This option requires pypsrp>=0.9.0 to be installed in the Ansible environment.
  • script - remove the currently unsupported decrypt argument from the module documentation (https://github.com/ansible/ansible/issues/86067).
  • service - add support for GNU Hurd systems, which use SysV init scripts (https://github.com/ansible/ansible/pull/86622).
  • slurp module gets new C(armor) option to allow user to disable base64 encoding.
  • stat - return disk_usage_bytes fact (https://github.com/ansible/ansible/issues/70834).
  • to_yaml / to_nice_yaml filters - Add optional vault_behavior argument to configure how vaulted values are rendered.

Breaking Changes / Porting Guide

  • psrp - Changed the default of negotiate_service used to build the Kerberos Service Principal Name from WSMAN to host. This aligns the defaults to how the native PowerShell PSRemoting client works on Windows and ensures that Kerberos can be used by more Windows targets by default. No deprecation period is used for this change as host is a builtin SPN to Windows and should improve compatibility out of the box. To go back to the old behaviour for any reason, set ansible_psrp_negotiate_service=WSMAN in the host vars.

Deprecated Features

  • The get_all_subclasses() function from ansible.module_utils.basic is deprecated and will be removed in ansible-core 2.24. Use get_all_subclasses() from ansible.module_utils.common._utils instead.
  • The get_platfrom() function from ansible.module_utils.basic is deprecated and will be removed in ansible-core 2.24. Use platform.system() from the Python standard library instead.
  • The load_platform_subclass() function from ansible.module_utils.basic is deprecated and will be removed in ansible-core 2.24. Use get_platform_subclass() from ansible.module_utils.common.sys_info instead.
  • PluginLoader - Deprecate unused aliases attribute. Plugins in a collection should define aliases in the meta/runtime.yml file using the redirect field instead.
  • ansible.module_utils.six - The six compatibility library provided at ansible.module_utils.six is deprecated, and planned for removal in ansible-core 2.24
  • apt_key - deprecate in favor of deb822_repository.
  • apt_repository - deprecate in favor of deb822_repository.
  • connection plugins - Added a soft deprecation on the connection attributes has_native_async and always_pipeline_modules. Connection plugins that wish to apply custom behaviour around pipelining should instead override the method is_pipelining_enabled(self, wrap_async=False) added in Ansible 2.19. For backwards compatibility no runtime deprecation warning is emitted but will be in the future.

Removed Features (previously deprecated)

Bugfixes