|
|
@ -1,4 +1,9 @@
|
|
|
|
---
|
|
|
|
---
|
|
|
|
|
|
|
|
- name: test
|
|
|
|
|
|
|
|
win_file:
|
|
|
|
|
|
|
|
path: "{{win_output_dir}}"
|
|
|
|
|
|
|
|
state: absent
|
|
|
|
|
|
|
|
|
|
|
|
- name: make sure win output dir exists
|
|
|
|
- name: make sure win output dir exists
|
|
|
|
win_file:
|
|
|
|
win_file:
|
|
|
|
path: "{{win_output_dir}}"
|
|
|
|
path: "{{win_output_dir}}"
|
|
|
@ -20,33 +25,32 @@
|
|
|
|
win_command: powershell.exe $env:windir
|
|
|
|
win_command: powershell.exe $env:windir
|
|
|
|
register: win_dir_value
|
|
|
|
register: win_dir_value
|
|
|
|
|
|
|
|
|
|
|
|
- name: expect failure when not passing in key option
|
|
|
|
- name: expect failure when not passing in path option
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
property: a
|
|
|
|
name: a
|
|
|
|
register: actual
|
|
|
|
register: actual
|
|
|
|
failed_when: "actual.msg != 'Missing required argument: key'"
|
|
|
|
failed_when: "actual.msg != 'Missing required argument: path'"
|
|
|
|
|
|
|
|
|
|
|
|
- name: expect failure when passing in an invalid hive
|
|
|
|
- name: expect failure when passing in an invalid hive
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
key: ABCD:\test
|
|
|
|
path: ABCD:\test
|
|
|
|
register: actual
|
|
|
|
register: actual
|
|
|
|
failed_when: actual.msg != "the hive in key is 'ABCD'; must be 'HKCR', 'HKCC', 'HKCU', 'HKLM' or 'HKU'"
|
|
|
|
failed_when: actual.msg != "the hive in path is 'ABCD'; must be 'HKCR', 'HKCC', 'HKCU', 'HKLM' or 'HKU'"
|
|
|
|
|
|
|
|
|
|
|
|
- name: get known nested reg key structure for testing with short hive form
|
|
|
|
- name: get known nested reg key structure for testing with short hive form
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
key: HKCU:\Test\nested
|
|
|
|
path: HKCU:\Test\nested
|
|
|
|
register: actual_short
|
|
|
|
register: actual_short
|
|
|
|
|
|
|
|
|
|
|
|
- name: get known nested reg key structure for testing with quoted yaml
|
|
|
|
- name: get known nested reg key structure for testing with quoted yaml
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
key: "HKCU:\\Test\\nested"
|
|
|
|
path: "HKCU:\\Test\\nested"
|
|
|
|
register: actual_quoted
|
|
|
|
register: actual_quoted
|
|
|
|
|
|
|
|
|
|
|
|
- name: set expected value for reg structure
|
|
|
|
- name: set expected value for reg structure
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
expected:
|
|
|
|
expected:
|
|
|
|
changed: false
|
|
|
|
changed: false
|
|
|
|
win_reg_stat:
|
|
|
|
|
|
|
|
exists: true
|
|
|
|
exists: true
|
|
|
|
properties:
|
|
|
|
properties:
|
|
|
|
binary: { raw_value: ["0x01", "0x16"], type: 'REG_BINARY', value: [1, 22] }
|
|
|
|
binary: { raw_value: ["0x01", "0x16"], type: 'REG_BINARY', value: [1, 22] }
|
|
|
@ -67,14 +71,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: get known reg key with no sub keys but some properties
|
|
|
|
- name: get known reg key with no sub keys but some properties
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
key: HKCU:\Test\single
|
|
|
|
path: HKCU:\Test\single
|
|
|
|
register: actual
|
|
|
|
register: actual
|
|
|
|
|
|
|
|
|
|
|
|
- name: set expected value for reg key with no sub keys but some properties
|
|
|
|
- name: set expected value for reg key with no sub keys but some properties
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
expected:
|
|
|
|
expected:
|
|
|
|
changed: false
|
|
|
|
changed: false
|
|
|
|
win_reg_stat:
|
|
|
|
|
|
|
|
exists: true
|
|
|
|
exists: true
|
|
|
|
properties:
|
|
|
|
properties:
|
|
|
|
none: { raw_value: [], type: 'REG_NONE', value: [] }
|
|
|
|
none: { raw_value: [], type: 'REG_NONE', value: [] }
|
|
|
@ -90,14 +93,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: get known reg key without sub keys and properties
|
|
|
|
- name: get known reg key without sub keys and properties
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
key: HKCU:\Test\nested\nest2
|
|
|
|
path: HKCU:\Test\nested\nest2
|
|
|
|
register: actual
|
|
|
|
register: actual
|
|
|
|
|
|
|
|
|
|
|
|
- name: set expected value for reg key without sub keys or properties
|
|
|
|
- name: set expected value for reg key without sub keys or properties
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
expected:
|
|
|
|
expected:
|
|
|
|
changed: false
|
|
|
|
changed: false
|
|
|
|
win_reg_stat:
|
|
|
|
|
|
|
|
exists: true
|
|
|
|
exists: true
|
|
|
|
properties: {}
|
|
|
|
properties: {}
|
|
|
|
sub_keys: []
|
|
|
|
sub_keys: []
|
|
|
@ -110,14 +112,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: get non-existant reg key
|
|
|
|
- name: get non-existant reg key
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
key: HKCU:\Test\Thispathwillneverexist
|
|
|
|
path: HKCU:\Test\Thispathwillneverexist
|
|
|
|
register: actual
|
|
|
|
register: actual
|
|
|
|
|
|
|
|
|
|
|
|
- name: set expected value for non-existant reg key
|
|
|
|
- name: set expected value for non-existant reg key
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
expected:
|
|
|
|
expected:
|
|
|
|
changed: false
|
|
|
|
changed: false
|
|
|
|
win_reg_stat:
|
|
|
|
|
|
|
|
exists: false
|
|
|
|
exists: false
|
|
|
|
|
|
|
|
|
|
|
|
- name: validate test
|
|
|
|
- name: validate test
|
|
|
@ -127,15 +128,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: get string property
|
|
|
|
- name: get string property
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
key: HKCU:\Test\nested
|
|
|
|
path: HKCU:\Test\nested
|
|
|
|
property: string
|
|
|
|
name: string
|
|
|
|
register: actual
|
|
|
|
register: actual
|
|
|
|
|
|
|
|
|
|
|
|
- name: set expected string property
|
|
|
|
- name: set expected string property
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
expected:
|
|
|
|
expected:
|
|
|
|
changed: false
|
|
|
|
changed: false
|
|
|
|
win_reg_stat:
|
|
|
|
|
|
|
|
exists: true
|
|
|
|
exists: true
|
|
|
|
raw_value: 'test'
|
|
|
|
raw_value: 'test'
|
|
|
|
type: 'REG_SZ'
|
|
|
|
type: 'REG_SZ'
|
|
|
@ -148,15 +148,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: get expand string property
|
|
|
|
- name: get expand string property
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
key: HKCU:\Test\nested
|
|
|
|
path: HKCU:\Test\nested
|
|
|
|
property: expand
|
|
|
|
name: expand
|
|
|
|
register: actual
|
|
|
|
register: actual
|
|
|
|
|
|
|
|
|
|
|
|
- name: set expected expand string property
|
|
|
|
- name: set expected expand string property
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
expected:
|
|
|
|
expected:
|
|
|
|
changed: false
|
|
|
|
changed: false
|
|
|
|
win_reg_stat:
|
|
|
|
|
|
|
|
exists: true
|
|
|
|
exists: true
|
|
|
|
raw_value: '%windir%\dir'
|
|
|
|
raw_value: '%windir%\dir'
|
|
|
|
type: 'REG_EXPAND_SZ'
|
|
|
|
type: 'REG_EXPAND_SZ'
|
|
|
@ -169,15 +168,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: get multi string property
|
|
|
|
- name: get multi string property
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
key: HKCU:\Test\nested
|
|
|
|
path: HKCU:\Test\nested
|
|
|
|
property: multi
|
|
|
|
name: multi
|
|
|
|
register: actual
|
|
|
|
register: actual
|
|
|
|
|
|
|
|
|
|
|
|
- name: set expected multi string property
|
|
|
|
- name: set expected multi string property
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
expected:
|
|
|
|
expected:
|
|
|
|
changed: false
|
|
|
|
changed: false
|
|
|
|
win_reg_stat:
|
|
|
|
|
|
|
|
exists: true
|
|
|
|
exists: true
|
|
|
|
raw_value: ['a, b', 'c']
|
|
|
|
raw_value: ['a, b', 'c']
|
|
|
|
type: 'REG_MULTI_SZ'
|
|
|
|
type: 'REG_MULTI_SZ'
|
|
|
@ -190,15 +188,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: get binary property
|
|
|
|
- name: get binary property
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
key: HKCU:\Test\nested
|
|
|
|
path: HKCU:\Test\nested
|
|
|
|
property: binary
|
|
|
|
name: binary
|
|
|
|
register: actual
|
|
|
|
register: actual
|
|
|
|
|
|
|
|
|
|
|
|
- name: set expected binary property
|
|
|
|
- name: set expected binary property
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
expected:
|
|
|
|
expected:
|
|
|
|
changed: false
|
|
|
|
changed: false
|
|
|
|
win_reg_stat:
|
|
|
|
|
|
|
|
exists: true
|
|
|
|
exists: true
|
|
|
|
raw_value: ["0x01", "0x16"]
|
|
|
|
raw_value: ["0x01", "0x16"]
|
|
|
|
type: 'REG_BINARY'
|
|
|
|
type: 'REG_BINARY'
|
|
|
@ -211,15 +208,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: get dword property
|
|
|
|
- name: get dword property
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
key: HKCU:\Test\nested
|
|
|
|
path: HKCU:\Test\nested
|
|
|
|
property: dword
|
|
|
|
name: dword
|
|
|
|
register: actual
|
|
|
|
register: actual
|
|
|
|
|
|
|
|
|
|
|
|
- name: set expected dword property
|
|
|
|
- name: set expected dword property
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
expected:
|
|
|
|
expected:
|
|
|
|
changed: false
|
|
|
|
changed: false
|
|
|
|
win_reg_stat:
|
|
|
|
|
|
|
|
exists: true
|
|
|
|
exists: true
|
|
|
|
raw_value: 1
|
|
|
|
raw_value: 1
|
|
|
|
type: 'REG_DWORD'
|
|
|
|
type: 'REG_DWORD'
|
|
|
@ -232,15 +228,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: get qword property
|
|
|
|
- name: get qword property
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
key: HKCU:\Test\nested
|
|
|
|
path: HKCU:\Test\nested
|
|
|
|
property: qword
|
|
|
|
name: qword
|
|
|
|
register: actual
|
|
|
|
register: actual
|
|
|
|
|
|
|
|
|
|
|
|
- name: set expected qword property
|
|
|
|
- name: set expected qword property
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
expected:
|
|
|
|
expected:
|
|
|
|
changed: false
|
|
|
|
changed: false
|
|
|
|
win_reg_stat:
|
|
|
|
|
|
|
|
exists: true
|
|
|
|
exists: true
|
|
|
|
raw_value: 1
|
|
|
|
raw_value: 1
|
|
|
|
type: 'REG_QWORD'
|
|
|
|
type: 'REG_QWORD'
|
|
|
@ -253,15 +248,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: get none property
|
|
|
|
- name: get none property
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
key: HKCU:\Test\single
|
|
|
|
path: HKCU:\Test\single
|
|
|
|
property: none
|
|
|
|
name: none
|
|
|
|
register: actual
|
|
|
|
register: actual
|
|
|
|
|
|
|
|
|
|
|
|
- name: set expected none property
|
|
|
|
- name: set expected none property
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
expected:
|
|
|
|
expected:
|
|
|
|
changed: false
|
|
|
|
changed: false
|
|
|
|
win_reg_stat:
|
|
|
|
|
|
|
|
exists: true
|
|
|
|
exists: true
|
|
|
|
raw_value: []
|
|
|
|
raw_value: []
|
|
|
|
type: 'REG_NONE'
|
|
|
|
type: 'REG_NONE'
|
|
|
@ -274,15 +268,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: get none with value property
|
|
|
|
- name: get none with value property
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
key: HKCU:\Test\single
|
|
|
|
path: HKCU:\Test\single
|
|
|
|
property: none1
|
|
|
|
name: none1
|
|
|
|
register: actual
|
|
|
|
register: actual
|
|
|
|
|
|
|
|
|
|
|
|
- name: set expected none with value property
|
|
|
|
- name: set expected none with value property
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
expected:
|
|
|
|
expected:
|
|
|
|
changed: false
|
|
|
|
changed: false
|
|
|
|
win_reg_stat:
|
|
|
|
|
|
|
|
exists: true
|
|
|
|
exists: true
|
|
|
|
raw_value: ["0x00"]
|
|
|
|
raw_value: ["0x00"]
|
|
|
|
type: 'REG_NONE'
|
|
|
|
type: 'REG_NONE'
|
|
|
@ -295,15 +288,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: get non-existance property
|
|
|
|
- name: get non-existance property
|
|
|
|
win_reg_stat:
|
|
|
|
win_reg_stat:
|
|
|
|
key: HKCU:\Test\single
|
|
|
|
path: HKCU:\Test\single
|
|
|
|
property: doesnotexist
|
|
|
|
name: doesnotexist
|
|
|
|
register: actual
|
|
|
|
register: actual
|
|
|
|
|
|
|
|
|
|
|
|
- name: set expected non-existance property
|
|
|
|
- name: set expected non-existance property
|
|
|
|
set_fact:
|
|
|
|
set_fact:
|
|
|
|
expected:
|
|
|
|
expected:
|
|
|
|
changed: false
|
|
|
|
changed: false
|
|
|
|
win_reg_stat:
|
|
|
|
|
|
|
|
exists: false
|
|
|
|
exists: false
|
|
|
|
|
|
|
|
|
|
|
|
- name: validate test
|
|
|
|
- name: validate test
|
|
|
@ -313,5 +305,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: remove registry entry
|
|
|
|
- name: remove registry entry
|
|
|
|
win_regedit:
|
|
|
|
win_regedit:
|
|
|
|
key: HKCU:\Test
|
|
|
|
path: HKCU:\Test
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|