ONTAP Rest API Discussions

Ansible Modules

Shift407
4,259 Views

I'm new to the NetApp Ansible Modules. Working on few reports and planning to use ansible module "na_ontap_info" to collect some data.  Module is working fine as long as i specifically mention one item in "gather_subset: " arugument, example "gather_subset: aggregate_info". Module is failing if i mention "all"  for the same argument like "gather_subset: all". I want to collect all the info in one task and then later parse it to get the required info. Is there anything that i'm doing wrong here?. augument "all" is no longer supported for "gather_subset" ?

 

Error: An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'tree'

 

 

- name: Gathering NetApp Information
   na_ontap_info:
           hostname: "{{ netapp_hostname }}"
           username: "{{ username }}"
           password: "{{ password }}"
           https: true
           validate_certs: false
           gather_subset: all
register: ontap_facts

1 ACCEPTED SOLUTION

Shift407
4,166 Views

excluding couple of entities from subset resolved the issue. May be due to the version inconsistencies. Thanks.

 

gather_subset: all

   - "!qtree_info"

   - "!quota_report"

View solution in original post

4 REPLIES 4

mbeattie
4,222 Views

Hi,

 

Try this, worked for me...

 

---
- hosts: localhost
  name: Get ONTAP Info
  gather_facts: false

  collections:
    - netapp.ontap

  vars_prompt:

    - name: "cluster"
      prompt: "Please enter the cluster name or IP Address"
      private: no

    - name: "username"
      prompt: "Please enter the username"
      private: no

    - name: "password"
      prompt: "Please enter password"
      private: yes

  vars:
    login: &login
      hostname: "{{ cluster }}"
      username: "{{ username }}"
      password: "{{ password }}"
      https: true
      validate_certs: false

  tasks:

  - name: Get ONTAP info
    na_ontap_info:
      gather_subset: all
      <<: *login
    register: ontap_info

  - debug:
      msg: "{{ ontap_info.ontap_info }}"

 

You might also consider asking questions regarding ansible on slack 

 

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

Shift407
4,210 Views

Thanks Matt for the response. Still running into the same issue after using the syntax you provided. Everything is working fine if i don't use "all" option. May be some issue with the collection version I'm using.   Thanks for the slack channel link. Will Join.

Shift407
4,167 Views

excluding couple of entities from subset resolved the issue. May be due to the version inconsistencies. Thanks.

 

gather_subset: all

   - "!qtree_info"

   - "!quota_report"

JohnChampion
4,161 Views

Just remove the entire "gather_subnet" line - you'll get all the info.

Public