ansible.builtin.win_regmerge (v2.5.15) — module

Merges the contents of a registry file into the windows registry

| "added in version" 2.1 of ansible.builtin"

Authors: Jon Hawkesworth (@jhawkesworth)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.5.15

Description

Wraps the reg.exe command to import the contents of a registry file.

Suitable for use with registry files created using M(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(win_template).

Registry file format is described at U(https://support.microsoft.com/en-us/kb/310516)

See also M(win_template), M(win_regedit)

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  # 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  # Compare and merge registry file
  - win_regmerge:
      path: C:/autodeploy/myCompany-settings.reg
      compare_to: HKLM:\SOFTWARE\myCompany

Inputs

    
path:
    default: no default
    description:
    - The full path including file name to the registry file on the remote machine to
      be merged
    required: true

compare_key:
    default: no default
    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.
    required: false

Outputs

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: boolean
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: boolean
difference_count:
  description: number of differences between the registry and the file
  returned: changed
  sample: 1
  type: int