---
- name: Create or update an network_access_network_condition
  hosts: ise_servers
  gather_facts: false
  tasks:
    # - name: Get all
    #   cisco.ise.network_access_network_condition_info:
    #     ise_hostname: "{{ ise_hostname }}"
    #     ise_username: "{{ ise_username }}"
    #     ise_password: "{{ ise_password }}"
    #     ise_verify: "{{ ise_verify }}"
    #   register: result

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

    # - name: Get by id
    #   cisco.ise.network_access_network_condition_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 network_access_network_condition
      cisco.ise.network_access_network_condition:
        ise_hostname: "{{ ise_hostname }}"
        ise_username: "{{ ise_username }}"
        ise_password: "{{ ise_password }}"
        ise_verify: "{{ ise_verify }}"
        state: present
        name: Endstation condition 1
        description: Optional description
        conditionType: EndstationCondition
        conditions:
          - ipAddrList:
              - 1.1.1.1
              - 2.2.2.2
          - macAddrList:
              - 00-0E-A6-A7-63-F7,00-0E-A6-A7-63-F8
              - 00-0E-A6-A7-63-F7,-ANY-
              - -ANY-,00-0E-A6-A7-63-F8
          - cliDnisList:
              - TBD
      register: result

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