Ansible, Windows and PowerShell: the Basics – Part 14, Registry Entries

In Part 14 of this series we’ll continue our journey with Ansible, Windows and PowerShell and look at how to handle registry entries in Windows.

In this example we’ll look at how to both create a new registry entry and update an existing registry entry using the win_regedit Ansible module.

Our current view of registry entry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters is as follows:

Our job template in AWX is _13_registry_entries:

The contents of _13_registry_entries.yml are as follows:

In the first step we create the new registry entry, in the second we update the existing entry.

Running a job from the _13_registry_entries job template produces the following result:

Observe the newly created and existing updated registry entries.