---
- name: Global credentials info
  hosts: dnac_servers
  vars_files:
    - credentials.yml
  gather_facts: false
  tasks:
    - name: Get all Global Credential by SubType
      cisco.dnac.global_credential_info:
        dnac_host: "{{ dnac_host }}"
        dnac_username: "{{ dnac_username }}"
        dnac_password: "{{ dnac_password }}"
        dnac_verify: "{{ dnac_verify }}"
        dnac_port: "{{ dnac_port }}"
        dnac_version: "{{ dnac_version }}"
        dnac_debug: "{{ dnac_debug }}"
        credentialSubType: HTTP_READ
        # sortBy:
        # order:
      register: global_credentials_result

    - name: Show global_credentials
      ansible.builtin.debug:
        msg: "{{ global_credentials_result }}"

    - name: Get Global Credential by id
      cisco.dnac.global_credential_info:
        dnac_host: "{{ dnac_host }}"
        dnac_username: "{{ dnac_username }}"
        dnac_password: "{{ dnac_password }}"
        dnac_verify: "{{ dnac_verify }}"
        dnac_port: "{{ dnac_port }}"
        dnac_version: "{{ dnac_version }}"
        dnac_debug: "{{ dnac_debug }}"
        id: babc42b9-0bdd-49ef-912e-66f533fb5d59
        credentialSubType: HTTP_READ
      register: global_credential_result

    - name: Show global_credential
      ansible.builtin.debug:
        msg: "{{ global_credential_result }}"
