Do you think IIT Guwahati certified course can help you in your career?
No
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.
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
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.
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
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
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.
Theansible-vault no longer supports PyCrypto and requires cryptography.
Deprecated
Python 2.6 on the target node
Bare variables in conditionals
The _remote_checksum() method in ActionBase
Modules
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
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
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.
To match ansible-core: raised python requirement from >=2.7 to >=3.8 of the ansible package.
Porting Guide for 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
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
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
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
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
Added Collections💼
community.sap (version 1.0.0)
Deprecated Features🔪
cisco.ios
Deprecates the lldp module.
Porting Guide for 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
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
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 -