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.
Topics
Playbook¶
- The deprecated task option
always_runhas been removed, please usecheck_mode: noinstead.
Deprecated¶
- In the nxos_igmp_interface module,
oif_prefixandoif_sourceproperties are deprecated. Useois_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 forwin_chocolateyhas been removed; usestate: latestinstead.The
rebootmodule option forwin_featurehas been removed; use thewin_rebootaction plugin instead.The
win_iis_webapppoolmodule no longer accepts a string for theattributesmodule option; use the free form dictionary value instead.The
namemodule option forwin_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 pathHCCCtoHKCC; useHKCCbecause this is the correct hive path.The file – Manage files and file properties now emits a deprecation warning when
srcis specified with a state other thanhardorlinkas 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 instance:$ 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_rawandopenshift_rawmodules have been aliased to the newk8smodule.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 thek8s_rawandopenshift_rawmodules.The
k8smodule may not accept resources where theapi_versionhas been changed to match the shortened version in the Kubernetes Python client. You should now specify the proper full Kubernetesapi_versionfor a resource.The
k8smodule can now process multi-document YAML files if they are passed with thesrcparameter. It will process each document as a separate resource. Resources provided inline with theresource_definitionparameter must still be a single document.The
k8smodule will not automatically changeProjectcreation requests intoProjectRequestcreation requests as theopenshift_rawmodule did. You must now specify theProjectRequestkind 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 theno_logparameter on the task block.The
k8s_scalemodule now supports scalable OpenShift objects, such asDeploymentConfig.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. Insteadopenstacksdkis used. Sinceopenstacksdkshould be already present as a dependency toshadeno additional actions are required.
Plugins¶
Deprecation notices¶
The following modules will be removed in Ansible 2.10. Please update your playbooks accordingly.
openshiftusek8sinstead.
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 theapi_versionhas been changed to match the shortened version in the Kubernetes Python client. You should now specify the proper full Kubernetesapi_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 theno_logparameter on the task block.
Porting custom scripts¶
No notable changes.
Networking¶
No notable changes.
Dynamic inventory scripts¶
contrib/inventory/openstack.pyhas been renamed tocontrib/inventory/openstack_inventory.py. If you have usedopenstack.pyas a name for your OpenStack dynamic inventory file, change it toopenstack_inventory.py. Otherwise the file name will conflict with imports fromopenstacksdk.