Note
This module is part of the community.windows collection (version 2.4.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.
Parameter | Comments |
|---|---|
compare_to 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. |
content string added in community.windows 2.2.0 | When used instead of |
path path | The full path including file name to the registry file on the remote machine to be merged |
Note
state=absent before using community.windows.win_regmerge.See also
Get information about Windows registry keys.
Add, change, or remove registry keys and values.
- 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
- name: Merge in a registry file specified as content without comparing to current registry
community.windows.win_regmerge:
content: |
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\myCompany]
"ExampleKey"=dword:00000001
- name: Compare and merge registry file specified as content
community.windows.win_regmerge:
content: |
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\myCompany]
"ExampleKey"=dword:00000001
compare_to: HKLM:\SOFTWARE\myCompany
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: |
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: |
difference_count integer | number of differences between the registry and the file Returned: changed Sample: |
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/community/windows/win_regmerge_module.html