1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration/targets/win_audit_policy_system/tasks/remove.yml
nwsparks cf6f6d09db new windows module win_audit_policy_system (#31046)
* new windows module win_audit_policy_system

* removed the backup/restore functionality

adjusted to use run-command rather than running the command directly

adjusted testing appropriately for the above changes

* fixed issue with variable naming in testing
removed .psm1 from requires
fixed copyright

* Updated audit_type to list and added appropriate error handling
Updated testing accordingly
Fixed up documentation
2017-12-04 17:42:36 -05:00

96 lines
2.4 KiB
YAML

#########################
### check mode remove ###
#########################
- name: check mode disable category
win_audit_policy_system:
category: "{{ category_name }}"
audit_type: none
check_mode: yes
register: category
- name: check mode disable subcategory
win_audit_policy_system:
subcategory: "{{ subcategory_name }}"
audit_type: none
check_mode: yes
register: subcategory
- name: check mode assert that changed is true
assert:
that:
- category | changed
- subcategory | changed
- name: check mode assert that audit_type is still "success" (old value) for category
assert:
that:
- item == "success"
with_items:
- "{{ category.current_audit_policy.values() | list | unique }}"
- name: check mode assert that audit_type is still "success and failure" (old value) for subcategory
assert:
that:
- item == "success and failure"
with_items:
- "{{ subcategory.current_audit_policy.values() | list }}"
######################
### disable policy ###
######################
- name: disable category
win_audit_policy_system:
category: "{{ category_name }}"
audit_type: none
register: category
- name: disable subcategory
win_audit_policy_system:
subcategory: "{{ subcategory_name }}"
audit_type: none
register: subcategory
- name: assert that changed is true
assert:
that:
- category | changed
- subcategory | changed
- name: assert that audit_type is "no auditing"
assert:
that:
- item == "no auditing"
with_items:
- "{{ subcategory.current_audit_policy.values() | list }}"
- "{{ category.current_audit_policy.values() | list | unique }}"
##########################
### idempotent disable ###
##########################
- name: idem disable category
win_audit_policy_system:
category: "{{ category_name }}"
audit_type: none
register: category
- name: idem disable subcategory
win_audit_policy_system:
subcategory: "{{ subcategory_name }}"
audit_type: none
register: subcategory
- name: idem assert that changed is false
assert:
that:
- not category | changed
- not subcategory | changed
- name: assert that audit_type is "no auditing"
assert:
that:
- item == "no auditing"
with_items:
- "{{ subcategory.current_audit_policy.values() | list }}"
- "{{ category.current_audit_policy.values() | list | unique }}"