Debugging - ansible-collections/netapp.ontap GitHub Wiki

Some tips to help debug connection issues

netapp.ontap.na_ontap_debug

Starting with netapp.ontap 21.1.0, you can use the **na_ontap_debug **module to help with REST and ZAPI connectivity issues:

https://github.com/ansible-collections/netapp.ontap/blob/main/playbooks/examples/support/debug_connectivity.yaml

tracing ZAPI and REST API calls

Another options is to trace API calls. Add the following in a task:

      feature_flags:
        trace_apis: true

You may also trace HTTP headers with:

      feature_flags:
        trace_apis: true
        trace_headers: true

⚠️ Tracing HTTP headers may expose secrets (eg when using basic authentication). It also adds a lot of verbosity which is generally not needed.

Starting with Ansible 2.12, you could also add enable tracing under module_defaults. This will trace all tasks. Depending on what you are looking for, it may be more efficient to enable trace on a single task.

  module_defaults:
    group/netapp.ontap.netapp_ontap:
      feature_flags:
        trace_apis: true

This writes a trace of ZAPI and REST calls into a /tmp/ontap_apis.log file.

Examples

  tasks:
    - name: disk info
      tags: disk
      na_ontap_rest_info:
        gather_subset: storage/disks
        fields: '*'
        feature_flags:
          trace_apis: true
  module_defaults:
    group/netapp.ontap.netapp_ontap:
      hostname: '{{ admin_ips[0] }}'
      username: '{{ admin_username }}'
      password: '{{ admin_password }}'
      https: true
      validate_certs: false
      feature_flags:
        trace_apis: true
        trace_headers: true

  tasks:
    - name: disk info
      tags: disk
      na_ontap_rest_info:
        gather_subset: storage/disks
        fields: '*'