Introduction

Ansible, the open-source automation platform, has released a new version with numerous enhancements, bug fixes, and security updates. Ansible has become a fundamental tool for managing IT infrastructure and applications, streamlining workflows, and maintaining infrastructure as code (IaC) principles.

Ansible 2.16

Let’s delve into the key changes introduced in this release:

Important Changes:

  • Drop Python 3.5 support for module execution.
  • Drop Python 3.9 support for the controller.
  • Add Python 3.12 support.
  • Preserve display context when proxying display over the queue.
  • Update TaskExecutor to not unnecessarily establish persistent ansible-connection when not needed.

Ansible Enhancements

  • Collection Path The INI config option “collections_paths” has been deprecated; please use the singular form “collections_path” instead. Additionally, the environment variable “ANSIBLE_COLLECTIONS_PATHS” is now deprecated, and you should use the singular form “ANSIBLE_COLLECTIONS_PATH” instead.

  • Removed Support for Windows Server 2012 and 2012 R2 as Microsoft’s support end of life on October 10th, 2023.

  • Remote Support New remotes have been added, including Alpine 3.18, Fedora 38, Fedora 38 container, FreeBSD 13.2 remote, RHEL 8.8 remotes, and RHEL 9.2 remotes, expanding compatibility across various platforms.

  • Python 3.12 Support Support for testing with Python 3.12 has been introduced, keeping Ansible up-to-date with the latest Python version.

  • Improved Container Naming Containers created by ansible-test now include the current test session ID in their name, avoiding conflicts between concurrent ansible-test invocations.

  • Improved Test Provisioning RHEL 8.8 and RHEL 9.2 provisioning can now be used with the --python 3.11 option, improving testing flexibility.

  • Streamlined Code Coverage Thread code coverage has been enabled alongside existing multiprocessing coverage, enhancing code quality assurance.

  • RHEL 8.8 and RHEL 9.2 Support Provisioning for RHEL 8.8 and RHEL 9.2 has been added, expanding compatibility for Red Hat Enterprise Linux users.

  • Deprecated Features Removal Several deprecated features have been removed, including the ‘smart’ connection option, deprecated INI config options, and support for older Windows Server versions.

CLI Improvements

  • Improved CLI Argument Parsing Support for automatically prepending with the help of CLI arguments that support being specified multiple times has been added, streamlining the command-line interface.

  • Default Transport DEFAULT_TRANSPORT now defaults to ‘ssh,’ while the ‘smart’ option is deprecated due to the decreasing relevance of control persist in newer OpenSSH versions.

Porting Guide

  • Python Type Hints One notable update is the addition of Python-type hints to the Display class, contributing to improved code readability and maintainability.

  • Galaxy Collection Warning To enhance user control, a new option, GALAXY_COLLECTIONS_PATH_WARNING, allows disabling warnings in the ansible-galaxy collection install process when installing a collection to an unconfigured path.

  • Default Python Interpreter Python 3.12 has been added to the default INTERPRETER_PYTHON_FALLBACK list, ensuring compatibility with the latest Python release.

  • DateTime Functions utcfromtimestamp and utcnow have been included in ansible.module_utils.compat.datetime to return fixed offset datetime objects, aiding in time management and conversions.

  • Distribution Server Timeout A general GALAXY_SERVER_TIMEOUT configuration option has been introduced for distribution servers, making it easier to manage distribution server timeouts effectively.

  • Python Type Annotations Python type annotations have been added to connection plugins, offering better code insights and helping developers write more reliable code.

Documentation Enhancements

  • Set Filters Clarification The documentation for set filters, including intersect, difference, symmetric_difference, and union, now explicitly states that the returned list items are in arbitrary order, offering clarity to users.

  • CleansingNodeVisitor Removal The CleansingNodeVisitor class and its usage have been removed due to templating changes that rendered it unnecessary, simplifying code and improving maintainability.

  • Manifest File Changes Several commands, such as exclude and recursive-exclude for generated files, have been removed from the MANIFEST.in file, as they were found to be unnecessary. This streamlines the release process.

  • Man Pages Generation The ansible-core sdist no longer contains pre-generated man pages. Instead, a script for generating man pages and standalone RST documentation is included in the sdist.

  • Directory Relocation The docs and examples directories have been relocated to the Ansible Documentation repository, making documentation management more organized.

  • Setuptools Version Requirement The minimum required setuptools version has been updated to 66.1.0, ensuring compatibility with Python 3.12.

Updates for Specific Platforms

  • SMGL OS Family The ansible_service_mgr fact has been updated to include the init system for the SMGL OS family.

  • Importlib Enhancements Where possible, importlib.resources.abc.TraversableResources is now used instead of the deprecated importlib.abc.TraversableResources.

  • Package Data in setup.cfg To avoid setuptools warnings, the package_data option is now used instead of include_package_data in setup.cfg.

  • GPG Check Enhancement The GPG check, provided internally by the transaction.run method, is now used instead of manual calling, improving the integrity of the process.

Templar Updates

  • Dict Constructor The dict constructor is no longer added to globals in Templar, as all required Jinja2 versions already include it.

Ansible-Galaxy Improvements

  • Collection and Metadata Filtering The ansible-doc command now allows filtering the listing of collections and metadata dump by more than one collection, improving search and retrieval capabilities.

  • Error Handling Improved error messages are provided for collection dependency resolution when pre-releases are not specified, enhancing the user experience.

  • File Extraction Warning A warning is now issued when extracting files from a role that contains illegal characters in file names, allowing users to address the issue proactively.

Security Updates

  • Symlink Prevention Ansible-galaxy now prevents roles from using symlinks to overwrite files outside of the installation directory, enhancing security (CVE-2023–5115).

Bug Fixes and Improvements

A range of bug fixes, enhancements, and improvements have been made, addressing issues related to handler notifications, symbolic modes, parsing multi-line Jinja2 blocks, module responses, and more. These updates contribute to a more stable and reliable Ansible experience.

Known Issues

While this release comes with numerous enhancements and fixes, there are a few known issues, such as difficulties with installing roles containing Java inner classes and limitations in detecting f-string spacing issues with the pep8 sanity test on specific Python versions.

Full Release Note

For a complete list of changes, consult the Ansible documentation and release notes for a comprehensive overview of what’s new and improved:

Conclusion

In conclusion, this Ansible 2.16.0 release represents a significant step forward in enhancing automation capabilities, improving documentation, and addressing security and usability concerns. Users are encouraged to update to the latest version to benefit from these enhancements and bug fixes.

Subscribe to the YouTube channel, Medium, and Website, X (formerly Twitter) to not miss the next episode of the Ansible Pilot.

Academy

Learn the Ansible automation technology with some real-life examples in my

My book Ansible By Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps

BUY the Complete PDF BOOK to easily Copy and Paste the 250+ Ansible code

Want to keep this project going? Please donate

Patreon Buy me a Pizza