---
- name: Test device_administration_authorization_exception_rules
  hosts: ise_servers
  gather_facts: false
  tasks:
    # - name: Get all
    #   cisco.ise.device_administration_local_exception_rules_info:
    #     ise_hostname: "{{ ise_hostname }}"
    #     ise_username: "{{ ise_username }}"
    #     ise_password: "{{ ise_password }}"
    #     ise_verify: "{{ ise_verify }}"
    #     policyId: cb32c3bc-c720-40c3-83e4-8897f9dd6943
    #   register: result

    # - name: Print all
    #   ansible.builtin.debug:
    #     var: result

    # - name: Get by id
    #   cisco.ise.device_administration_local_exception_rules_info:
    #     ise_hostname: "{{ ise_hostname }}"
    #     ise_username: "{{ ise_username }}"
    #     ise_password: "{{ ise_password }}"
    #     ise_verify: "{{ ise_verify }}"
    #     id: d704e911-a916-11eb-8830-2ec507028ea8
    #   register: result

    - name: Create or update an device_administration_local_exception_rules
      cisco.ise.device_administration_local_exception_rules:
        ise_hostname: "{{ ise_hostname }}"
        ise_username: "{{ ise_username }}"
        ise_password: "{{ ise_password }}"
        ise_verify: "{{ ise_verify }}"
        ise_debug: "{{ ise_debug }}"
        state: present
        rule:
          default: false
          name: Test3
          hitCounts: 0
          rank: 0
          state: disabled
          condition:
            conditionType: ConditionReference
            isNegate: false
            dictionaryName: Network Access
            attributeName: EapAuthentication
            operator: equals
            attributeValue: EAP-MSCHAPv2
            name: EAP-MSCHAPv2
            id: c456a490-0429-4fd4-91d7-efd1eb1f855a
        policyId: cb32c3bc-c720-40c3-83e4-8897f9dd6943
        # id: 2f3bb55b-e004-4792-9019-d448b8c0534
        commands:
          - DenyAllCommands
        profile: Default Shell Profile
      register: result

    - name: Print result
      ansible.builtin.debug:
        var: result
