community.windows.win_regmerge module – Merges the contents of a registry file into the Windows registry

Note

This module is part of the community.windows collection (version 1.13.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.windows.

To use it in a playbook, specify: community.windows.win_regmerge.

Synopsis

Parameters

Parameter

Comments

compare_key

string

The parent key to use when comparing the contents of the registry to the contents of the file. Needs to be in HKLM or HKCU part of registry. Use a PS-Drive style path for example HKLM:\SOFTWARE not HKEY_LOCAL_MACHINE\SOFTWARE If not supplied, or the registry key is not found, no comparison will be made, and the module will report changed.

path

path / required

The full path including file name to the registry file on the remote machine to be merged

Notes

Note

  • Organise your registry files so that they contain a single root registry key if you want to use the compare_to functionality.

  • This module does not force registry settings to be in the state described in the file. If registry settings have been modified externally the module will merge the contents of the file but continue to report differences on subsequent runs.

  • To force registry change, use ansible.windows.win_regedit with state=absent before using community.windows.win_regmerge.

See Also

See also

ansible.windows.win_reg_stat

Get information about Windows registry keys.

ansible.windows.win_regedit

Add, change, or remove registry keys and values.

Examples

- name: Merge in a registry file without comparing to current registry
  community.windows.win_regmerge:
    path: C:\autodeploy\myCompany-settings.reg

- name: Compare and merge registry file
  community.windows.win_regmerge:
    path: C:\autodeploy\myCompany-settings.reg
    compare_to: HKLM:\SOFTWARE\myCompany

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

compare_to_key_found

boolean

whether the parent registry key has been found for comparison

Returned: when comparison key not found in registry

Sample: false

compared

boolean

whether a comparison has taken place between the registry and the file

Returned: when a comparison key has been supplied and comparison has been attempted

Sample: true

difference_count

integer

number of differences between the registry and the file

Returned: changed

Sample: 1

Authors

  • Jon Hawkesworth (@jhawkesworth)