Get information about Windows registry keys
- Like :ref:`ansible.windows.win_file <ansible.windows.win_file_module>`, :ref:`ansible.windows.win_reg_stat <ansible.windows.win_reg_stat_module>` will return whether the key/property exists.
- It also returns the sub keys and properties of the key specified.
- If specifying a property name through property, it will return the information specific for that property.
Note
- The
properties
return value will contain an empty string key""
that refers to the key'sDefault
value. If the value has not been set then this key is not returned.
.. seealso:: :ref:`ansible.windows.win_regedit_module` The official documentation on the **ansible.windows.win_regedit** module. :ref:`ansible.windows.win_regmerge_module` The official documentation on the **ansible.windows.win_regmerge** module.
- name: Obtain information about a registry key using short form
ansible.windows.win_reg_stat:
path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion
register: current_version
- name: Obtain information about a registry key property
ansible.windows.win_reg_stat:
path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion
name: CommonFilesDir
register: common_files_dir
- name: Obtain the registry key's (Default) property
ansible.windows.win_reg_stat:
path: HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion
name: ''
register: current_version_default
Common return values are documented here, the following are the fields unique to this module:
- Jordan Borean (@jborean93)