mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
134 lines
3.4 KiB
YAML
134 lines
3.4 KiB
YAML
|
---
|
||
|
- name: fail with invalid section name
|
||
|
win_security_policy:
|
||
|
section: This is not a valid section
|
||
|
key: KeyName
|
||
|
value: 0
|
||
|
register: fail_invalid_section
|
||
|
failed_when: fail_invalid_section.msg != "The section 'This is not a valid section' does not exist in SecEdit.exe output ini"
|
||
|
|
||
|
- name: fail with invalid key name
|
||
|
win_security_policy:
|
||
|
section: System Access
|
||
|
key: InvalidKey
|
||
|
value: 0
|
||
|
register: fail_invalid_key
|
||
|
failed_when: fail_invalid_key.msg != "The key 'InvalidKey' in section 'System Access' is not a valid key, cannot set this value"
|
||
|
|
||
|
- name: change existing key check
|
||
|
win_security_policy:
|
||
|
section: Event Audit
|
||
|
key: AuditSystemEvents
|
||
|
value: 1
|
||
|
register: change_existing_check
|
||
|
check_mode: yes
|
||
|
|
||
|
- name: get actual change existing key check
|
||
|
test_win_security_policy:
|
||
|
section: Event Audit
|
||
|
key: AuditSystemEvents
|
||
|
register: change_existing_actual_check
|
||
|
|
||
|
- name: assert change existing key check
|
||
|
assert:
|
||
|
that:
|
||
|
- change_existing_check|changed
|
||
|
- change_existing_actual_check.value == 0
|
||
|
|
||
|
- name: change existing key
|
||
|
win_security_policy:
|
||
|
section: Event Audit
|
||
|
key: AuditSystemEvents
|
||
|
value: 1
|
||
|
register: change_existing
|
||
|
|
||
|
- name: get actual change existing key
|
||
|
test_win_security_policy:
|
||
|
section: Event Audit
|
||
|
key: AuditSystemEvents
|
||
|
register: change_existing_actual
|
||
|
|
||
|
- name: assert change existing key
|
||
|
assert:
|
||
|
that:
|
||
|
- change_existing|changed
|
||
|
- change_existing_actual.value == 1
|
||
|
|
||
|
- name: change existing key again
|
||
|
win_security_policy:
|
||
|
section: Event Audit
|
||
|
key: AuditSystemEvents
|
||
|
value: 1
|
||
|
register: change_existing_again
|
||
|
|
||
|
- name: assert change existing key again
|
||
|
assert:
|
||
|
that:
|
||
|
- not change_existing_again|changed
|
||
|
- change_existing_again.value == 1
|
||
|
|
||
|
- name: change existing key with string type
|
||
|
win_security_policy:
|
||
|
section: Event Audit
|
||
|
key: AuditSystemEvents
|
||
|
value: "1"
|
||
|
register: change_existing_key_with_type
|
||
|
|
||
|
- name: assert change existing key with string type
|
||
|
assert:
|
||
|
that:
|
||
|
- not change_existing_key_with_type|changed
|
||
|
- change_existing_key_with_type.value == "1"
|
||
|
|
||
|
- name: change existing string key check
|
||
|
win_security_policy:
|
||
|
section: System Access
|
||
|
key: NewGuestName
|
||
|
value: New Guest
|
||
|
register: change_existing_string_check
|
||
|
check_mode: yes
|
||
|
|
||
|
- name: get actual change existing string key check
|
||
|
test_win_security_policy:
|
||
|
section: System Access
|
||
|
key: NewGuestName
|
||
|
register: change_existing_string_actual_check
|
||
|
|
||
|
- name: assert change existing string key check
|
||
|
assert:
|
||
|
that:
|
||
|
- change_existing_string_check|changed
|
||
|
- change_existing_string_actual_check.value == "Guest"
|
||
|
|
||
|
- name: change existing string key
|
||
|
win_security_policy:
|
||
|
section: System Access
|
||
|
key: NewGuestName
|
||
|
value: New Guest
|
||
|
register: change_existing_string
|
||
|
|
||
|
- name: get actual change existing string key
|
||
|
test_win_security_policy:
|
||
|
section: System Access
|
||
|
key: NewGuestName
|
||
|
register: change_existing_string_actual
|
||
|
|
||
|
- name: assert change existing string key
|
||
|
assert:
|
||
|
that:
|
||
|
- change_existing_string|changed
|
||
|
- change_existing_string_actual.value == "New Guest"
|
||
|
|
||
|
- name: change existing string key again
|
||
|
win_security_policy:
|
||
|
section: System Access
|
||
|
key: NewGuestName
|
||
|
value: New Guest
|
||
|
register: change_existing_string_again
|
||
|
|
||
|
- name: assert change existing string key again
|
||
|
assert:
|
||
|
that:
|
||
|
- not change_existing_string_again|changed
|
||
|
- change_existing_string_again.value == "New Guest"
|