Ansible 2.9 gives resource models a go

Ansible 2.9 gives resource models a go

Ansible 2.9 has been released a bit later than originally planned, after Red Hat decided a couple more release candidates were needed to get the latest version of the IT automation platform just right.

One of the major differences to previous versions are the newly introduced resource modules, which automation engineers might want to look into. Resource modules are able “to read and configure a specific network service on a network device” (the scope comprises  a single resource only) and can be combined for the configuration of complex network setups. The list of newly added modules is therefore appropriately extensive and can be researched in the project’s GitHub repository.

Compared to earlier modules, resource modules include the state values merged, replaced, overridden, and deleted to define how configurations are handled. Resource modules also come with consistent return values, making sure that a playbook will receive the same key/value pairs “after a network resource module has made (or suggested) the necessary changes on a network device”.

The project’s developers also promise to develop modules and facts integration (to derive information from the remote systems) for given network resources “across all our supported network operating systems at the same time”, making them universally usable quicker.

Ansible users are advised to check the 2.9 Porting Guide before changing to the new version. A lot of modules sporting a _facts postfix (something like aws_region_facts) for example have been renamed to something with an _info postfix (aws_region_info), to clarify they return values not unique to the host. To access their return values, it is now necessary to register a variable for most of them, since the modules no longer return ansible_facts.

It also has to be considered, that hash_behaviour now affects inventory sources. If it is it set to merge for example, inventory data might change which means playbooks have to be updated accordingly. On top of that, the way to import PowerShell or C# module utils from a collection has changed and Galaxy token file has been rehoused to ~/.ansible/galaxy_token.

Other module changes worth noting include openssh_keypair now applying the same file permissions and ownership to both public and private keys, and adjustments to the openssl_certificate key identifier creation. The vmware_cluster meanwhile was split into vmware_cluster_drs, vmware_cluster_ha, and vmware_cluster_vsan for easier maintenance.

The full list of changes, which also include some new plugins, can be found in the project’s changelog.