Documentation

win_regmerge - Merges the contents of a registry file into the windows registry

New in version 2.1.

Synopsis

Wraps the reg.exe command to import the contents of a registry file. Suitable for use with registry files created using 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 win_template. Registry file format is described at https://support.microsoft.com/en-us/kb/310516 See also win_template, win_regedit

Options

parameter required default choices comments
compare_key
no no default
    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
    yes no default
      The full path including file name to the registry file on the remote machine to be merged

      Examples

      # Merge in a registry file without comparing to current registry
      # Note that paths using / to separate are preferred as they require less special handling than \
      win_regmerge:
        path: C:/autodeploy/myCompany-settings.reg
      # Compare and merge registry file
      win_regmerge:
        path: C:/autodeploy/myCompany-settings.reg
        compare_to: HKLM:\SOFTWARE\myCompany
      

      Return Values

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

      name description returned type sample
      difference_count number of differences between the registry and the file changed integer 1
      compared whether a comparison has taken place between the registry and the file when a comparison key has been supplied and comparison has been attempted boolean True
      compare_to_key_found whether the parent registry key has been found for comparison when comparison key not found in registry boolean False


      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 win_regedit with state=absent before using win_regmerge.

      This is an Extras Module

      For more information on what this means please read Extras Modules

      For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.