ansible/test/integration/targets/win_audit_policy_system/tasks/remove.yml

97 lines
2.4 KiB
YAML
Raw Normal View History

#########################
### 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 }}"