Merges the contents of a registry file into the Windows registry
- Wraps the reg.exe command to import the contents of a registry file.
- Suitable for use with registry files created using :ref:`ansible.windows.win_template <ansible.windows.win_template_module>`.
- 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 :ref:`ansible.windows.win_template <ansible.windows.win_template_module>`.
- Registry file format is described at https://support.microsoft.com/en-us/kb/310516
- See also :ref:`ansible.windows.win_template <ansible.windows.win_template_module>`, :ref:`ansible.windows.win_regedit <ansible.windows.win_regedit_module>`
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 :ref:`ansible.windows.win_regedit <ansible.windows.win_regedit_module>` with
state=absent
before usingcommunity.windows.win_regmerge
.
.. seealso:: :ref:`ansible.windows.win_reg_stat_module` The official documentation on the **ansible.windows.win_reg_stat** module. :ref:`ansible.windows.win_regedit_module` The official documentation on the **ansible.windows.win_regedit** module.
- 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
Common return values are documented here, the following are the fields unique to this module:
- Jon Hawkesworth (@jhawkesworth)