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

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 is changed
- subcategory is 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 is changed
- subcategory is 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:
- category is not changed
- subcategory is not 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 }}"