community / community.windows / 2.2.0 / module / win_regmerge Merges the contents of a registry file into the Windows registry Authors: Jon Hawkesworth (@jhawkesworth)community.windows.win_regmerge (2.2.0) — module
Install with ansible-galaxy collection install community.windows:==2.2.0
collections: - name: community.windows version: 2.2.0
Wraps the reg.exe command to import the contents of a registry file.
Suitable for use with registry files created using M(ansible.windows.win_template).
Windows registry files have a specific format and must be constructed correctly with carriage return and line feed line endings otherwise they will not be merged.
Exported registry files often start with a Byte Order Mark which must be removed if the file is to templated using M(ansible.windows.win_template).
Registry file format is described at U(https://support.microsoft.com/en-us/kb/310516)
See also M(ansible.windows.win_template), M(ansible.windows.win_regedit)
- 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
path: description: - The full path including file name to the registry file on the remote machine to be merged type: path content: description: - When used instead of O(path), merges the value specified into the Windows registry. It must not include the Byte Order Mark. type: str version_added: 2.2.0 version_added_collection: community.windows compare_to: description: - 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. type: str
compare_to_key_found: description: whether the parent registry key has been found for comparison returned: when comparison key not found in registry sample: false type: bool compared: description: 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 type: bool difference_count: description: number of differences between the registry and the file returned: changed sample: 1 type: int