---
- name: Dell OpenManage Ansible iDRAC Diagnostics.
  hosts: idrac
  gather_facts: false

  tasks:
    - name: Run and export the diagnostics to local path
      dellemc.openmanage.idrac_diagnostics:
        idrac_ip: "192.168.0.1"
        idrac_user: "idrac_user"
        idrac_password: "idrac_password"
        ca_path: "path/to/ca_file"
        run: true
        export: true
        share_parameters:
          share_type: "local"
          share_name: "/opt/local/diagnostics/"
          file_name: "diagnostics.txt"
      delegate_to: localhost

    - name: Run the diagnostics with power cycle reboot on schedule
      dellemc.openmanage.idrac_diagnostics:
        idrac_ip: "192.168.0.1"
        idrac_user: "idrac_user"
        idrac_password: "idrac_password"
        ca_path: "path/to/ca_file"
        run: true
        run_mode: "express"
        reboot_type: "power_cycle"
        scheduled_start_time: 20240101101015
      delegate_to: localhost

    - name: Run and export the diagnostics to HTTPS share
      dellemc.openmanage.idrac_diagnostics:
        idrac_ip: "192.168.0.1"
        idrac_user: "idrac_user"
        idrac_password: "idrac_password"
        ca_path: "path/to/ca_file"
        run: true
        export: true
        share_parameters:
          share_type: "HTTPS"
          ignore_certificate_warning: "on"
          share_name: "/share_path/diagnostics_collection_path"
          ip_address: "192.168.0.2"
          file_name: "diagnostics.txt"
        delegate_to: localhost

    - name: Run and export the diagnostics to NFS share
      dellemc.openmanage.idrac_diagnostics:
        idrac_ip: "192.168.0.1"
        idrac_user: "idrac_user"
        idrac_password: "idrac_password"
        ca_path: "path/to/ca_file"
        run: true
        export: true
        share_parameters:
          share_type: "NFS"
          share_name: "nfsshare/diagnostics_collection_path/"
          ip_address: "192.168.0.3"
          file_name: "diagnostics.txt"
      delegate_to: localhost

    - name: Export the diagnostics to CIFS share
      dellemc.openmanage.idrac_diagnostics:
        idrac_ip: "192.168.0.1"
        idrac_user: "idrac_user"
        idrac_password: "idrac_password"
        ca_path: "path/to/ca_file"
        export: true
        share_parameters:
          share_type: "CIFS"
          share_name: "/cifsshare/diagnostics_collection_path/"
          ip_address: "192.168.0.4"
          file_name: "diagnostics.txt"
      delegate_to: localhost

    - name: Export the diagnostics to HTTPS share via proxy
      dellemc.openmanage.idrac_diagnostics:
        idrac_ip: "192.168.0.1"
        idrac_user: "idrac_user"
        idrac_password: "idrac_password"
        ca_path: "path/to/ca_file"
        export: true
        share_parameters:
          share_type: "HTTPS"
          share_name: "/share_path/diagnostics_collection_path"
          ignore_certificate_warning: "on"
          ip_address: "192.168.0.2"
          file_name: "diagnostics.txt"
          proxy_support: parameters_proxy
          proxy_type: http
          proxy_server: "192.168.0.5"
          proxy_port: 1080
          proxy_username: "proxy_user"
          proxy_password: "proxy_password"
      delegate_to: localhost
