Ansible 2.6 Porting Guide
This section discusses the behavioral changes between Ansible 2.5 and Ansible 2.6.
It is intended to assist in updating your playbooks, plugins and other parts of your Ansible infrastructure so they will work with this version of Ansible.
We suggest you read this page along with Ansible Changelog for 2.6 to understand what updates you may need to make.
This document is part of a collection on porting. The complete list of porting guides can be found at porting guides.
Playbook
- The deprecated task option - always_runhas been removed, please use- check_mode: noinstead.
Deprecated
- In the nxos_igmp_interface module, - oif_prefixand- oif_sourceproperties are deprecated. Use- ois_psparameter with a dictionary of prefix and source to values instead.
Modules
Major changes in popular modules are detailed here:
Modules removed
The following modules no longer exist:
Deprecation notices
The following modules will be removed in Ansible 2.10. Please update your playbooks accordingly.
Noteworthy module changes
- The - upgrademodule option for- win_chocolateyhas been removed; use- state: latestinstead.
- The - rebootmodule option for- win_featurehas been removed; use the- win_rebootaction plugin instead.
- The - win_iis_webapppoolmodule no longer accepts a string for the- attributesmodule option; use the free form dictionary value instead.
- The - namemodule option for- win_packagehas been removed; this is not used anywhere and should just be removed from your playbooks.
- The - win_regeditmodule no longer automatically corrects the hive path- HCCCto- HKCC; use- HKCCbecause this is the correct hive path.
- The file_module now emits a deprecation warning when - srcis specified with a state other than- hardor- linkas it is only supposed to be useful with those. This could have an effect on people who were depending on a buggy interaction between src and other state’s to place files into a subdirectory. For example:- $ ansible localhost -m file -a 'path=/var/lib src=/tmp/ state=directory'- Would create a directory named - /tmp/lib. Instead of the above, simply spell out the entire destination path like this:- $ ansible localhost -m file -a 'path=/tmp/lib state=directory'
- The - k8s_rawand- openshift_rawmodules have been aliased to the new- k8smodule.
- The - k8smodule supports all Kubernetes resources including those from Custom Resource Definitions and aggregated API servers. This includes all OpenShift resources.
- The - k8smodule will not accept resources where subkeys have been snake_cased. This was a workaround that was suggested with the- k8s_rawand- openshift_rawmodules.
- The - k8smodule may not accept resources where the- api_versionhas been changed to match the shortened version in the Kubernetes Python client. You should now specify the proper full Kubernetes- api_versionfor a resource.
- The - k8smodule can now process multi-document YAML files if they are passed with the- srcparameter. It will process each document as a separate resource. Resources provided inline with the- resource_definitionparameter must still be a single document.
- The - k8smodule will not automatically change- Projectcreation requests into- ProjectRequestcreation requests as the- openshift_rawmodule did. You must now specify the- ProjectRequestkind explicitly.
- The - k8smodule will not automatically remove secrets from the Ansible return values (and by extension the log). In order to prevent secret values in a task from being logged, specify the- no_logparameter on the task block.
- The - k8s_scalemodule now supports scalable OpenShift objects, such as- DeploymentConfig.
- The - lineinfilemodule was changed to show a warning when using an empty string as a regexp. Since an empty regexp matches every line in a file, it will replace the last line in a file rather than inserting. If this is the desired behavior, use- '^'which will match every line and will not trigger the warning.
- Openstack modules are no longer using - shadelibrary. Instead- openstacksdkis used. Since- openstacksdkshould be already present as a dependency to- shadeno additional actions are required.
Plugins
Deprecation notices
The following modules will be removed in Ansible 2.10. Please update your playbooks accordingly.
- openshiftuse- k8sinstead.
Noteworthy plugin changes
- The - k8slookup plugin now supports all Kubernetes resources including those from Custom Resource Definitions and aggregated API servers. This includes all OpenShift resources.
- The - k8slookup plugin may not accept resources where the- api_versionhas been changed to match the shortened version in the Kubernetes Python client. You should now specify the proper full Kubernetes- api_versionfor a resource.
- The - k8slookup plugin will no longer remove secrets from the Ansible return values (and by extension the log). In order to prevent secret values in a task from being logged, specify the- no_logparameter on the task block.
Porting custom scripts
No notable changes.
Networking
No notable changes.
Dynamic inventory scripts
- contrib/inventory/openstack.pyhas been renamed to- contrib/inventory/openstack_inventory.py. If you have used- openstack.pyas a name for your OpenStack dynamic inventory file, change it to- openstack_inventory.py. Otherwise the file name will conflict with imports from- openstacksdk.
