---
- name: Manage support bundle on ISE
  hosts: ise_servers
  gather_facts: false
  tasks:
    # - name: Create or update an support_bundle
    #   cisco.ise.support_bundle:
    #     ise_hostname: "{{ ise_hostname }}"
    #     ise_username: "{{ ise_username }}"
    #     ise_password: "{{ ise_password }}"
    #     ise_verify: "{{ ise_verify }}"
    #     name: supportBundle
    #     description: Support Bundle Generation
    #     hostName: ise
    #     supportBundleIncludeOptions:
    #       includeConfigDB: true
    #       includeDebugLogs: true
    #       includeLocalLogs: true
    #       includeCoreFiles: true
    #       mntLogs: true
    #       includeSystemLogs: true
    #       policyXml: true
    #       fromDate: 07/19/2021
    #       toDate: 07/20/2021
    #   register: result

    - name: Support bundle status
      cisco.ise.support_bundle_status_info:
        ise_hostname: "{{ ise_hostname }}"
        ise_username: "{{ ise_username }}"
        ise_password: "{{ ise_password }}"
        ise_verify: "{{ ise_verify }}"
        ise_debug: true
        id: ise
      register: support_bundle_status_result

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

    - name: Support bundle download
      cisco.ise.support_bundle_download:
        ise_hostname: "{{ ise_hostname }}"
        ise_username: "{{ ise_username }}"
        ise_password: "{{ ise_password }}"
        ise_verify: "{{ ise_verify }}"
        ise_debug: true
        dirPath: /Users/fmunoz/Desktop/Work/Github/ISE/ansible-ise/
        fileName: "Name.jpg"
      register: support_bundle_download_result

    # - name: Print support_bundle_download_result
    #   ansible.builtin.debug:
    #     var: support_bundle_status_result
    #   when: support_bundle_download_result
