Add Windows Registry on Windows-like systems — Ansible module win_regedit

How to automate the creation of the Windows Registry key “name” and “value” under a specified “path” on Windows-like systems with Ansible Playbook using win_regedit module.

Luca Berton

--

How to Add Windows Registry key-value on Windows-like systems with Ansible?

Changing registry values manually can be time-consuming and error-prone.

Ansible includes built-in capabilities for managing individual key-value pairs in an idempotent way.

I’m going to show you a live demo and some simple Ansible code.

I’m Luca Berton and welcome to today’s episode of Ansible Pilot

Ansible adds Windows Registry on Windows-like systems

  • `ansible.windows.win_regedit`
  • Get information about Windows registry keys

Let’s talk about the Ansible module `win_regedit`.

The full name is `ansible.windows.win_regedit`, which means that is part of the collection of modules specialized to interact with Windows target host.

It’s a module pretty stable and out for years and it works in Windows and Windows Server operating systems.

It adds, changes, or remove registry keys and values.

Parameters

  • path string — The full registry key path including the hive to search for
  • name string — Name of the registry entry in the path parameters.
  • type string — string / none / binary / dword / expandstring / multistring / qword
  • data string — Value of the registry entry
  • state string — present / absent

The only mandatory parameter is “path” which is the full registry key path including the hive to search for.

Almost mandatory is also the “name” of the name of the registry entry in the path…

--

--

Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday