ansible/test/integration/targets/win_regedit/tasks/main.yml

91 lines
2.6 KiB
YAML
Raw Normal View History

---
- name: make sure testing keys are removed before test
win_regedit:
path: '{{item}}'
delete_key: yes
state: absent
with_items:
- '{{test_win_regedit_local_key}}'
- '{{test_win_regedit_classes_key}}'
- block:
- name: run tests for each property type
include_tasks: create_tests.yml
vars:
test_win_regedit_key_type: '{{item.type}}'
test_win_regedit_key_expected_type: '{{item.reg_type}}'
test_win_regedit_key_data1: '{{item.data1}}'
test_win_regedit_key_data2: '{{item.data2}}'
test_win_regedit_key_expected_value_null: '{{item.value_null}}'
test_win_regedit_key_expected_value1: '{{item.value1}}'
test_win_regedit_key_expected_value2: '{{item.value2}}'
items:
- type: dword
reg_type: REG_DWORD
data1: 1337 # decimal format
data2: 0xffffffff # hex format and larger number
value_null: 0
value1: 1337
value2: 4294967295
- type: qword
reg_type: REG_QWORD
data1: 18446744073709551615 # larger decimal format
data2: 0x1ffffffff # hex format and larger number
value_null: 0
value1: 18446744073709551615
value2: 8589934591
- type: string
reg_type: REG_SZ
data1: hello world
data2: new hello world
value_null: ""
value1: hello world
value2: new hello world
- type: expandstring
reg_type: REG_EXPAND_SZ
data1: '%windir%\test'
data2: '%AppData%\local'
value_null: ""
value1: '%windir%\test'
value2: '%AppData%\local'
- type: multistring
reg_type: REG_MULTI_SZ
data1: 'entry1' # test single entry as multi string
data2: ['entry1', 2]
value_null: []
value1: ['entry1']
value2: ['entry1', '2']
- type: binary
reg_type: REG_BINARY
data1: hex:00,01,ee,ff # testing hex string format with hex: in front
data2: [0xff, 0xee, 0x01, 0x00] # testing using just raw hex values
value_null: []
value1: ["0x00", "0x01", "0xee", "0xff"]
value2: ["0xff", "0xee", "0x01", "0x00"]
- type: none
reg_type: REG_NONE
data1: aa,bb,be,ef # testing hex string format with hex: in front
data2: [0x01, 0x02]
value_null: []
value1: ["0xaa", "0xbb", "0xbe", "0xef"]
value2: ["0x01", "0x02"]
- name: run remaining tests
include_tasks: tests.yml
always:
- name: make sure testing keys are removed after test
win_regedit:
path: '{{item}}'
delete_key: yes
state: absent
with_items:
- '{{test_win_regedit_local_key}}'
- '{{test_win_regedit_classes_key}}'