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_run
has been removed, please usecheck_mode: no
instead.
Deprecated
- In the nxos_igmp_interface module,
oif_prefix
andoif_source
properties are deprecated. Useois_ps
parameter 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
upgrade
module option forwin_chocolatey
has been removed; usestate: latest
instead.The
reboot
module option forwin_feature
has been removed; use thewin_reboot
action plugin instead.The
win_iis_webapppool
module no longer accepts a string for theattributes
module option; use the free form dictionary value instead.The
name
module option forwin_package
has been removed; this is not used anywhere and should just be removed from your playbooks.The
win_regedit
module no longer automatically corrects the hive pathHCCC
toHKCC
; useHKCC
because this is the correct hive path.The file – Manage files and file properties now emits a deprecation warning when
src
is specified with a stateother thanhard
orlink
as it is only supposed to be useful with those. This could havean effect on people who were depending on a buggy interaction between src and other state’s toplace 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 entiredestination path like this:
- $ ansible localhost -m file -a 'path=/tmp/lib state=directory'
The
k8s_raw
andopenshift_raw
modules have been aliased to the newk8s
module.The
k8s
module supports all Kubernetes resources including those from Custom Resource Definitions and aggregated API servers. This includes all OpenShift resources.The
k8s
module will not accept resources where subkeys have been snake_cased. This was a workaround that was suggested with thek8s_raw
andopenshift_raw
modules.The
k8s
module may not accept resources where theapi_version
has been changed to match the shortened version in the Kubernetes Python client. You should now specify the proper full Kubernetesapi_version
for a resource.The
k8s
module can now process multi-document YAML files if they are passed with thesrc
parameter. It will process each document as a separate resource. Resources provided inline with theresource_definition
parameter must still be a single document.The
k8s
module will not automatically changeProject
creation requests intoProjectRequest
creation requests as theopenshift_raw
module did. You must now specify theProjectRequest
kind explicitly.The
k8s
module 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_log
parameter on the task block.The
k8s_scale
module now supports scalable OpenShift objects, such asDeploymentConfig
.The
lineinfile
module 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 ratherthan inserting. If this is the desired behavior, use'^'
which will match every line andwill not trigger the warning.Openstack modules are no longer using
shade
library. Insteadopenstacksdk
is used. Sinceopenstacksdk
should be already present as a dependency toshade
no additional actions are required.
Plugins
Deprecation notices
The following modules will be removed in Ansible 2.10. Please update your playbooks accordingly.
openshift
usek8s
instead.
Noteworthy plugin changes
- The
k8s
lookup plugin now supports all Kubernetes resources including those from Custom Resource Definitions and aggregated API servers. This includes all OpenShift resources. - The
k8s
lookup plugin may not accept resources where theapi_version
has been changed to match the shortened version in the Kubernetes Python client. You should now specify the proper full Kubernetesapi_version
for a resource. - The
k8s
lookup 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_log
parameter on the task block.
Porting custom scripts
No notable changes.
Networking
No notable changes.
Dynamic inventory scripts
contrib/inventory/openstack.py
has been renamed tocontrib/inventory/openstack_inventory.py
. If you have usedopenstack.py
as a name for your OpenStack dynamic inventory file, change it toopenstack_inventory.py
. Otherwise the file name will conflict with imports fromopenstacksdk
.