Table of contents
1.
Introduction🤔
2.
Ansible 5 Porting Guide📙
2.1.
Playbook
2.2.
Python Interpreter Discovery
2.3.
Command Line
2.4.
Deprecated
2.5.
Modules
2.6.
Plugins
3.
Porting Guide for Ansible v5.0.0
3.1.
Added Collections💼
3.2.
Known Issues🐛
3.3.
Breaking Changes🪜
3.4.
Major Changes🧤
3.5.
Removed Features🧹
3.6.
Deprecated Features🔪
4.
Porting Guide for Ansible v5.0.1
4.1.
Major Changes🧤
5.
Porting Guide for Ansible v5.1.0
5.1.
Known Issues🐛
5.2.
Major Changes🧤
5.3.
Removed Features🧹
5.4.
Deprecated Features🔪
6.
Porting Guide for Ansible v5.2.0
6.1.
Known Issues🐛
6.2.
Major Changes🧤
6.3.
Deprecated Features🔪
7.
Porting Guide for Ansible v5.3.0
7.1.
Major Changes🧤
7.2.
Deprecated Features🔪
8.
Porting Guide for Ansible v5.4.0
8.1.
Major Changes🧤
8.2.
Deprecated Features🔪
9.
Porting Guide for Ansible v5.5.0
9.1.
Known Issues🐛
9.2.
Deprecated Features🔪
10.
Porting Guide for Ansible v5.6.0
10.1.
Added Collections💼
10.2.
Deprecated Features🔪
11.
Porting Guide for Ansible v5.7.0
11.1.
Major Changes🧤
11.2.
Deprecated Features🔪
12.
Porting Guide for Ansible v5.8.0
12.1.
Added Collections💼
12.2.
Breaking Changes🪜
12.3.
Major Changes🧤
12.4.
Deprecated Features🔪
13.
Porting Guide for Ansible v5.9.0
13.1.
Added Collections💼
13.2.
Major Changes🧤
13.3.
Deprecated Features🔪
14.
Frequently Asked Questions
14.1.
What is Ansible?
14.2.
Why Ansible?
14.3.
How does Ansible work?
14.4.
What is an Ansible playbook?
14.5.
What are Ansible tasks?
15.
Conclusion
Last Updated: Mar 27, 2024
Easy

Ansible 5 Porting Guide

Author Sanchit Kumar
0 upvote
Career growth poll
Do you think IIT Guwahati certified course can help you in your career?

Introduction🤔

Ansible is an open-source IT automation tool that automates application deployment, provisioning, configuration management, orchestration, and other manual IT processes.
Ansible 5 porting guide will discuss playbook, python interpreter discovery, command line, deprecated things, other notable changes in Ansible 5 and changes in different versions of Ansible 5 porting guide.

ansible 5 porting guide

Are you ready❓Let us see Ansible 5 porting guide.

Ansible 5 Porting Guide📙

The Ansible 5 is based on Ansible-core 2.12.

Playbook

playbook

When calling tasks and setting the async, setting ANSIBLE_ASYNC_DIR under 'environment:' is no longer valid. Rather, use the shell configuration variable async_dir.

Example -  by setting ansible_async_dir -

tasks:
  - dnf:
      name: '*'
      state: latest
    async: 500
    poll: 6
    vars:
      ansible_async_dir: /path/customdirectory
You can also try this code with Online Python Compiler
Run Code


The undef() function for creating undefined variables directly in a template is added to the templating environment. Optionally, you may provide a hint for variables intended to be overridden.

vars:
  old: "{{ undef }}"
  new: "{{ undef() }}"
  new_with_hint: "{{ undef(hint='You need to over-ride this variable') }}"
You can also try this code with Online Python Compiler
Run Code

Python Interpreter Discovery

python interpreter discovery
  • The default value of INTERPRETER_PYTHON has been changed to auto.
  • In INTERPRETER_PYTHON_FALLBACK, python interpreters changed to prefer python3 over the lower version python2.
    The combination of the above two changes means the new default behaviour is to quietly prefer python3 over python2 on remote hosts.


Note - INTERPRETER_PYTHON_FALLBACK can be changed from the default list of interpreters by setting the ansible_interpreter_python_fallback variable.

Command Line

command line
  • Python 3.8 on the controller node is an absolute requirement for this release. The command line scripts won't function with a lower python version.
  • The ansible-vault no longer supports PyCrypto and requires cryptography.

Deprecated

deprecated
  • Python 2.6 on the target node
  • Bare variables in conditionals
  • The _remote_checksum() method in ActionBase

Modules

module
  • The cron now requires the name to be specified in all cases and no longer allows a reboot parameter. Use special_time: reboot instead.
     
  • Hostname - On FreeBSD, if a permanent hostname file does not exist, the before result won't be 'temporarystub' anymore. It will be the empty string ("") for consistency with other systems.
     
  • Hostname - On the OpenRC and Solaris-based systems, if the permanent hostname file does not exist, the before result won't be "UNKNOWN" anymore. It will be the empty string ("") for consistency with other systems.
     
  • The pip with Ansible 5 uses the pip python module installed for the Ansible module's python interpreter.

Plugins

plugin
  • The unique filter with Jinja2 < 2.10 is case-sensitive and now raises an error.
     
  • Set theory filters are now case-sensitive (intersect, difference, symmetric_difference and union).
     
  • When an option is unspecified, password_hash` now uses passlib defaults.


Note - In Ansible 5: no modules were removed, no deprecation notices, no noteworthy changes in modules and no notable changes in porting custom scripts and networking.

Now let us proceed further in this Ansible 5 porting guide and see porting guide for Ansible v5.0.0 to v5.9.0🏄.

Porting Guide for Ansible v5.0.0

ansible v5.0.0

Added Collections💼

  • cisco.ise (version 1.2.1)
  • cloud.common (version 2.1.0)
  • community.ciscosmb (version 1.0.4)
  • community.dns (version 2.0.3)
  • infoblox.nios_modules (version 1.1.2)
  • netapp.storagegrid (version 21.7.0)

Known Issues🐛

Ansible-core

ansible-test - Tab completion anywhere except the end of the command with the new composite options will give incorrect results.

dellemc.openmanage

Issues in - idrac_user, ome_device_power_settings, ome_smart_fabric_uplink.

purestorage.flashblade

purefb_lag - The mac_address field in the response is not populated.

Breaking Changes🪜

Ansible-core

  • Action, module, and group names in module_defaults must be static values. Their values can still be templates.
  • Fully qualified 'ansible.legacy' plugin names are not included implicitly in action_groups.
  • Unresolvable groups, action plugins, and modules in module_defaults are an error.
  • Other changes in - ansible-test, conditionals, hostname and unique filter.


Other breaking changes to the - amazon.aws, arista.eos, community.aws, community.crypto, community.dns, community.docker, community.general, community.hashi_vault, community.okd, community.routeros, community.zabbix, kubernetes.core and netapp.storagegrid.

Major Changes🧤

Ansible-core

  • Python Controller Requirement - Python 3.8 or newer is required for the control node
  • Various changes in ansible-test.
  • JUnit callback - The junit_xml and ordereddict Python modules are no longer required to use the JUnit callback plugin.


Other major changes to the - amazon.aws, cisco.ise, cloud.common, cloudscale_ch.cloud, community.aws, community.ciscosmb, community.dns, community.general, community.kubernetes, community.okd, community.postgresql, community.vmware, containers.podman, dellemc.openmanage, fortinet.fortios, gluster.gluster, hetzner.hcloud, kubernetes.core, netapp.cloudmanager, netbox.netbox, openvswitch.openvswitch and ovirt.ovirt.

Removed Features🧹

Ansible-core

  • The built-in module_util ansible.module_utils.common.removed has been removed.
  • Connections removed password check stubs that had been moved to become plugins.
  • The task, inline parameters being auto coerced into variables, has been removed.


ansible.windows

Removed shutdown_timeout and shutdown_timeout_sec in win_reboot.


Other features removed from - community.crypto, community.docker, community.general and community.hashi_vault.

Deprecated Features🔪

Ansible-core

  • ansible-test - The --docker-no-pull option and --no-pip-check option are deprecated and have no effect.
  • Include action is deprecated in favour of import_tasks,include_tasks, and import_playbook.
  • The module_utils' FileLock is scheduled to be removed.


amazon.aws

The boto-based ec2 module in ec2, the setting of the ec2_elb fact in ec2_classic_lb, and the new_config return key in ec2_vpc_dhcp_option all have been deprecated.


ansible.netcommon

The automatic setting of look_for_keys in the paramiko_ssh setting of network_cli will be removed.


ansible.windows

The ability to ignore unreachable hosts with ignore_errors: True is removed. Now you can use ignore_unreachable: True.

win_updates - Deprecated the filtered_reason return value for each filtered up in favour of filtered_reasons, the use_scheduled_task option and the whitelist and blacklist options in favour of accept_list and reject_list, respectively.


Other deprecated features from - 

arista.eos, cisco.ios, cisco.iosxr, cisco.nxos, community.aws, community.azure, community.crypto, community.dns, community.docker, community.general, community.grafana, community.hashi_vault, community.kubernetes, community.vmware, inspur.sm, junipernetworks.junos and vyos.vyos.

Porting Guide for Ansible v5.0.1

ansible v5.0.1

Major Changes🧤

To match ansible-core: raised python requirement from >=2.7 to >=3.8 of the ansible package.

Porting Guide for Ansible v5.1.0

ansible v5.1.0

Known Issues🐛

dellemc.openmanage

Issues in idrac_user, ome_application_alerts_smtp, ome_application_alerts_syslog, ome_device_network_services, ome_device_power_settings and ome_smart_fabric_uplink.

Major Changes🧤

Major changes in containers.podman - added podman_tag module and secrets driver and driver opts support.

Removed Features🧹

The 'legacy' integration test setup has been removed from the community.hashi_vault.

Deprecated Features🔪

  • Various modules in cisco.nxos are deprecated.
  • Deprecated the attribute ModuleHelper.VarDict in module_helper module utils of community.general.
  • Support for Ansible 2.9 and ansible-base 2.10 is deprecated, and the aws_iam_login method has been renamed to aws_iam in the aws_iam_login auth method of community.hashi_vault.
  • 'router_id' options are deprecated in junipernetworks.junos from junos_ospf_interfaces, junos_ospfv2 and junos_ospfv3 resource module.

Porting Guide for Ansible v5.2.0

ansible v5.2.0

Known Issues🐛

  • dellemc.openmanage: Issues in Idrac_user, me_application_alerts_smtp, ome_application_alerts_syslog, ome_device_local_access_configuration, ome_device_local_access_configuration, ome_device_network_services, ome_device_power_settings and ome_smart_fabric_uplink.
  • Issues in purefa_admin of purestorage.flasharray.

Major Changes🧤

cisco.meraki

  • meraki_mr_radio - New module.

Deprecated Features🔪

Deprecated in favour of M(purefa_admin). Will be removed in Collection 2.0 in purefa_sso of purestorage.flasharray.

Porting Guide for Ansible v5.3.0

ansible v5.3.0

Major Changes🧤

Changes in bigip_device_info of F5networks.f5_modules.

Deprecated Features🔪

community.general

  • Not specifying the sender of the mail callback plugin is deprecated and will be disallowed in the community.general 6.0.0.

Porting Guide for Ansible v5.4.0

ansible v5.4.0

Major Changes🧤

chocolatey.chocolatey

  • win_chocolatey - Added choco_args option to pass additional arguments directly to Chocolatey.


vyos.vyos

  • Add 'pool' as value to server key in ntp_global.

Deprecated Features🔪

cisco.ios

  • ios_acls - Deprecated fragment attribute added boolean alternate as enable_fragment.

Porting Guide for Ansible v5.5.0

ansible v5.5.0

Known Issues🐛

community.general

Issues in the pacman - update_cache and binaries specified in the executable parameter.

Deprecated Features🔪

community.general

pacman - from community.general 5.0.0 on, the changed status of update_cache will no longer be ignored if the name or upgrade is specified. 

Porting Guide for Ansible v5.6.0

ansible v5.6.0

Added Collections💼

  • community.sap (version 1.0.0)

Deprecated Features🔪

cisco.ios

  • Deprecates the lldp module.

Porting Guide for Ansible v5.7.0

ansible v5.7.0

Major Changes🧤

community.postgresql

postgresql_user - in community.postgresql 3.0.0, the priv argument has been deprecated and will be removed. You can use the postgresql_privs module to grant/revoke privileges instead.


fortinet.fortios

  • Support FortiOS 7.0.2, 7.0.3, 7.0.4, 7.0.5.

Deprecated Features🔪

  • nmcli - deprecate default hairpin mode for a bridge.
  • proxmox inventory plugin - the current default true of the want_proxmox_nodes_ansible_host option has been deprecated. In community.general 6.0.0, the default is changed to false.

Porting Guide for Ansible v5.8.0

ansible v5.8.0

Added Collections💼

  • vmware.vmware_rest (version 2.1.5)

Breaking Changes🪜

vmware.vmware_rest

  • The vmware_rest 2.0.0 support vSphere 7.0.2 onwards.
  • Changes in vcenter_vm_storage_policy - the format of the disks parameter has changed, and the module has a new mandatory parameter: vm_home.

Major Changes🧤

The community.mysql and community.postgresql collection no longer supports Ansible 2.9 and ansible-base 2.10.

Deprecated Features🔪

community.hashi_vault

token_validate options - in community.hashi_vault version 4.0.0, the shared auth option token_validate will change its default from True to False. The vault_login lookup and module will keep the default value of True.


community.network

Support for Ansible 2.9 and ansible-base 2.10 is deprecated.


vmware.vmware_rest

  • vcenter_vm_storage_policy_compliance - drop the module, it returns 404 error.
  • vcenter_vm_tools - remove the upgrade state.
  • vcenter_vm_tools_installer - remove the module from the collection.

Porting Guide for Ansible v5.9.0

ansible v5.9.0

Added Collections💼

  • cisco.dnac (version 6.4.0)
  • community.sap_libs (version 1.1.0)

Major Changes🧤

fortinet.fortios

  • Support FortiOS 7.0.2, 7.0.3, 7.0.4, 7.0.5.

Deprecated Features🔪

  • In this version, the collection community.sap has been renamed to the community.sap_libs.
  • In this version, the content in the community.sap was replaced with deprecated redirects to the new collection in Ansible 7.0.0, and these redirects will eventually be removed from Ansible. You should update your FQCNs for the community.sap.


community.docker

  • Support for Ansible 2.9 and ansible-base 2.10 is deprecated.
  • The dependency on docker-compose for execution environments is deprecated and will be removed in the community.docker 3.0.0.
  • The default of tls_hostname in various modules and the return value out and err in docker_Stack are removed in version 3.0.0.
     

NOTE - To see more detailed information related to added collections, known issues, breaking changes, major changes, removed features and deprecated features in Ansible v5.0.0 to Ansible v5.9.0 versions, you may refer to Ansible official documentation.

Frequently Asked Questions

What is Ansible?

Ansible is an open-source IT automation tool sponsored by Red Hat.

Why Ansible?

While working in IT, you are likely doing the same tasks repeatedly. To deal with such a scenario, Ansible is helpful. You need to write solutions once and then automate your solutions as we advance.

How does Ansible work?

Ansible works by establishing a connection to the task you wish to automate and then pushing programs that carry out instructions that would have been done manually.

What is an Ansible playbook?

An Ansible playbook is a blueprint of automation tasks.

What are Ansible tasks?

The task is a unit action of Ansible. For example, to install a package or update software.

Conclusion

In this article, we learnt about the Ansible 5 porting guide. We discussed playbook, python interpreter discovery, command line, deprecated things, other notable changes in Ansible 5 and changes in different versions of Ansible 5.

See the official website for documentation and other information about Ansible.

We hope this article on Ansible 5 porting guide was helpful. You can refer to other similar articles as well - 


Refer to our guided paths on Coding Ninjas Studio to learn more about DSA, Competitive Programming, JavaScript, System Design, etc. Enrol in our courses and refer to the mock test and problems available. Take a look at the interview experiences and interview bundle for placement preparations.

Happy Learning Ninja! 🥷

Live masterclass