Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using na_ontap_rest_info with an ONTAP 9.1 array errors out and doesn't fallback to ZAPI #217

Open
dbuenoparedes opened this issue Aug 28, 2024 · 3 comments
Labels
enhancement New feature or request Jira Has an Internal Jira Story

Comments

@dbuenoparedes
Copy link

Summary

When I run a playbook that I tested and works on ONTAP 9.6+ arrays I wanted to use the same for an older array that cannot be updated beyond ONTAP 9.1. Although the first task that I run is this one:

- name: Gather SVM vserver info
  netapp.ontap.na_ontap_rest_info:
    gather_subset:
      - vserver_info
  register: ontap_vserver_info

Even though the use_rest has the default value (auto) I get a failure when running it against the ONTAP 9.1 array:

fatal: [op1sn01]: FAILED! => changed=false 
  ansible_facts:
    discovered_interpreter_python: /usr/bin/python3
  invocation:
    module_args:
      cert_filepath: null
      feature_flags: null
      fields: null
      force_ontap_version: null
      gather_subset:
      - vserver_info
      hal_linking: true
      hostname: 10.15.12.110
      http_port: null
      https: true
      ignore_api_errors: null
      key_filepath: null
      max_records: 1024
      ontapi: null
      owning_resource: null
      parameters: null
      password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
      state: null
      use_python_keys: false
      use_rest: auto
      username: admin
      validate_certs: false
  msg: 'Error using REST for version, error: 404 Client Error: Not Found for url: https://10.15.12.110/api/cluster?fields=version.  Error using REST for version, status_code: 404.'

This seems that it doesn't fallback or tries ZAPI in this case when it should.

Component Name

na_ontap_rest_info

Ansible Version

$ ansible --version
ansible [core 2.16.7]
  config file = /home/dbuenoparedes/git-repos/8x8/ansible-vcc/ansible.cfg
  configured module search path = ['/home/dbuenoparedes/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/dbuenoparedes/git-repos/8x8/ansible-vcc/venv/lib/python3.10/site-packages/ansible
  ansible collection location = /home/dbuenoparedes/git-repos/8x8/ansible-vcc/collections
  executable location = /home/dbuenoparedes/git-repos/8x8/ansible-vcc/venv/bin/ansible
  python version = 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0] (/home/dbuenoparedes/git-repos/8x8/ansible-vcc/venv/bin/python3)
  jinja version = 3.1.4
  libyaml = True

ONTAP Collection Version

$ ansible-galaxy collection list
# /home/dbuenoparedes/git-repos/8x8/ansible-vcc/collections/ansible_collections
Collection                               Version
---------------------------------------- -------
purestorage.flasharray                   1.31.0 

# /home/dbuenoparedes/git-repos/8x8/ansible-vcc/venv/lib/python3.10/site-packages/ansible_collections
Collection                               Version
---------------------------------------- -------
amazon.aws                               7.6.0  
ansible.netcommon                        5.3.0  
ansible.posix                            1.5.4  
ansible.utils                            2.12.0 
ansible.windows                          2.3.0  
arista.eos                               6.2.2  
awx.awx                                  23.9.0 
azure.azcollection                       1.19.0 
check_point.mgmt                         5.2.3  
chocolatey.chocolatey                    1.5.1  
cisco.aci                                2.9.0  
cisco.asa                                4.0.3  
cisco.dnac                               6.13.3 
cisco.intersight                         2.0.9  
cisco.ios                                5.3.0  
cisco.iosxr                              6.1.1  
cisco.ise                                2.9.1  
cisco.meraki                             2.18.1 
cisco.mso                                2.6.0  
cisco.nxos                               5.3.0  
cisco.ucs                                1.10.0 
cloud.common                             2.1.4  
cloudscale_ch.cloud                      2.3.1  
community.aws                            7.2.0  
community.azure                          2.0.0  
community.ciscosmb                       1.0.9  
community.crypto                         2.20.0 
community.digitalocean                   1.26.0 
community.dns                            2.9.1  
community.docker                         3.10.1 
community.general                        8.6.1  
community.grafana                        1.8.0  
community.hashi_vault                    6.2.0  
community.hrobot                         1.9.2  
community.library_inventory_filtering_v1 1.0.1  
community.libvirt                        1.3.0  
community.mongodb                        1.7.4  
community.mysql                          3.9.0  
community.network                        5.0.2  
community.okd                            2.3.0  
community.postgresql                     3.4.1  
community.proxysql                       1.5.1  
community.rabbitmq                       1.3.0  
community.routeros                       2.15.0 
community.sap                            2.0.0  
community.sap_libs                       1.4.2  
community.sops                           1.6.7  
community.vmware                         4.4.0  
community.windows                        2.2.0  
community.zabbix                         2.4.0  
containers.podman                        1.13.0 
cyberark.conjur                          1.2.2  
cyberark.pas                             1.0.25 
dellemc.enterprise_sonic                 2.4.0  
dellemc.openmanage                       8.7.0  
dellemc.powerflex                        2.4.0  
dellemc.unity                            1.7.1  
f5networks.f5_modules                    1.28.0 
fortinet.fortimanager                    2.5.0  
fortinet.fortios                         2.3.6  
frr.frr                                  2.0.2  
gluster.gluster                          1.0.2  
google.cloud                             1.3.0  
grafana.grafana                          2.2.5  
hetzner.hcloud                           2.5.0  
hpe.nimble                               1.1.4  
ibm.qradar                               2.1.0  
ibm.spectrum_virtualize                  2.0.0  
ibm.storage_virtualize                   2.3.1  
infinidat.infinibox                      1.4.5  
infoblox.nios_modules                    1.6.1  
inspur.ispim                             2.2.1  
inspur.sm                                2.3.0  
junipernetworks.junos                    5.3.1  
kaytus.ksmanage                          1.2.1  
kubernetes.core                          2.4.2  
lowlydba.sqlserver                       2.3.2  
microsoft.ad                             1.5.0  
netapp.aws                               21.7.1 
netapp.azure                             21.10.1
netapp.cloudmanager                      21.22.1
netapp.elementsw                         21.7.0 
netapp.ontap                             22.11.0
netapp.storagegrid                       21.12.0
netapp.um_info                           21.8.1 
netapp_eseries.santricity                1.4.0  
netbox.netbox                            3.18.0 
ngine_io.cloudstack                      2.3.0  
ngine_io.exoscale                        1.1.0  
openstack.cloud                          2.2.0  
openvswitch.openvswitch                  2.1.1  
ovirt.ovirt                              3.2.0  
sensu.sensu_go                           1.14.0 
splunk.es                                2.1.2  
t_systems_mms.icinga_director            2.0.1  
telekom_mms.icinga_director              1.35.0 
theforeman.foreman                       3.15.0 
vmware.vmware_rest                       2.3.1  
vultr.cloud                              1.12.1 
vyos.vyos                                4.1.0  
wti.remote                               1.0.5

ONTAP Version

op1sn01::> version
NetApp Release 9.1P19: Mon May 27 09:09:01 UTC 2019

Playbook

module_defaults:
    group/netapp.ontap.netapp_ontap:
      hostname: "{{ ansible_host }}"
      username: "{{ netapp_user }}"
      password: "{{ netapp_password }}"
      https: true
      validate_certs: false

- name: Gather SVM vserver info
  netapp.ontap.na_ontap_rest_info:
    gather_subset:
      - vserver_info
  register: ontap_vserver_info

Steps to Reproduce

Run the task against a Netapp array running ONTAP 9.1 (any ONTAP <9.6) and watch the task fail instead of falling back to ZAPI.

Expected Results

I expect na_ontap_rest_info detect it's talking to an array that is not REST compatible and needs to switch to ZAPI.

Actual Results

TASK [Gather SVM vserver info] ********************************************************************************************************************************
task path: /home/dbuenoparedes/git-repos/8x8/ansible-vcc/playbooks/netapps/_create-nfs-shares.yml:8
Wednesday 28 August 2024  12:08:44 -0400 (0:00:00.086)       0:00:00.171 ****** 
<10.15.12.110> ESTABLISH LOCAL CONNECTION FOR USER: dbuenoparedes
<10.15.12.110> EXEC /bin/sh -c 'echo ~dbuenoparedes && sleep 0'
<10.15.12.110> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /home/dbuenoparedes/.ansible/tmp `"&& mkdir "` echo /home/dbuenoparedes/.ansible/tmp/ansible-tmp-1724861324.8250463-39372-54886675313025 `" && echo ansible-tmp-1724861324.8250463-39372-54886675313025="` echo /home/dbuenoparedes/.ansible/tmp/ansible-tmp-1724861324.8250463-39372-54886675313025 `" ) && sleep 0'
<op1sn01> Attempting python interpreter discovery
<10.15.12.110> EXEC /bin/sh -c 'echo PLATFORM; uname; echo FOUND; command -v '"'"'python3.12'"'"'; command -v '"'"'python3.11'"'"'; command -v '"'"'python3.10'"'"'; command -v '"'"'python3.9'"'"'; command -v '"'"'python3.8'"'"'; command -v '"'"'python3.7'"'"'; command -v '"'"'python3.6'"'"'; command -v '"'"'/usr/bin/python3'"'"'; command -v '"'"'/usr/libexec/platform-python'"'"'; command -v '"'"'python2.7'"'"'; command -v '"'"'/usr/bin/python'"'"'; command -v '"'"'python'"'"'; echo ENDFOUND && sleep 0'
<10.15.12.110> EXEC /bin/sh -c '/home/dbuenoparedes/git-repos/8x8/ansible-vcc/venv/bin/python3.10 && sleep 0'
Using module file /home/dbuenoparedes/git-repos/8x8/ansible-vcc/venv/lib/python3.10/site-packages/ansible_collections/netapp/ontap/plugins/modules/na_ontap_rest_info.py
<10.15.12.110> PUT /home/dbuenoparedes/.ansible/tmp/ansible-local-39356hrxpj22l/tmp2mbaf8oj TO /home/dbuenoparedes/.ansible/tmp/ansible-tmp-1724861324.8250463-39372-54886675313025/AnsiballZ_na_ontap_rest_info.py
<10.15.12.110> EXEC /bin/sh -c 'chmod u+x /home/dbuenoparedes/.ansible/tmp/ansible-tmp-1724861324.8250463-39372-54886675313025/ /home/dbuenoparedes/.ansible/tmp/ansible-tmp-1724861324.8250463-39372-54886675313025/AnsiballZ_na_ontap_rest_info.py && sleep 0'
<10.15.12.110> EXEC /bin/sh -c '/usr/bin/python3 /home/dbuenoparedes/.ansible/tmp/ansible-tmp-1724861324.8250463-39372-54886675313025/AnsiballZ_na_ontap_rest_info.py && sleep 0'
<10.15.12.110> EXEC /bin/sh -c 'rm -f -r /home/dbuenoparedes/.ansible/tmp/ansible-tmp-1724861324.8250463-39372-54886675313025/ > /dev/null 2>&1 && sleep 0'
fatal: [op1sn01]: FAILED! => changed=false 
  ansible_facts:
    discovered_interpreter_python: /usr/bin/python3
  invocation:
    module_args:
      cert_filepath: null
      feature_flags: null
      fields: null
      force_ontap_version: null
      gather_subset:
      - vserver_info
      hal_linking: true
      hostname: <cluster_IP>
      http_port: null
      https: true
      ignore_api_errors: null
      key_filepath: null
      max_records: 1024
      ontapi: null
      owning_resource: null
      parameters: null
      password: VALUE_SPECIFIED_IN_NO_LOG_PARAMETER
      state: null
      use_python_keys: false
      use_rest: auto
      username: admin
      validate_certs: false
  msg: 'Error using REST for version, error: 404 Client Error: Not Found for url: https://<cluster_IP>/api/cluster?fields=version.  Error using REST for version, status_code: 404.'
@joecaruso
Copy link
Contributor

The na_ontap_rest_info module is specifically designed for REST (hence the name), so falling back to ZAPI would be unexpected behavior. You want to use the na_ontap_info module instead, which is implemented with ZAPI.

@dbuenoparedes
Copy link
Author

dbuenoparedes commented Aug 29, 2024

Thank you for the clarification @joecaruso, this is what I knew before reading about the use_rest described in this link:

na_ontap_rest_info-use_rest-description

I was confused because I still saw that na_ontap_info was there and na_ontap_rest_info clearly indicates in its name (as you pointed) that is a REST module.

I would suggest an update in the documentation, either to remove that flag from that module (na_ontap_rest_info) or update the description pointing this out with a link to na_ontap_info for ZAPI. It could prevent some confusion (myself as a good first hand example).

Thanks

Edit: attached screenshot of use_rest under na_ontap_rest_info module

@csahu9
Copy link

csahu9 commented Sep 2, 2024

@joecaruso Thank you for your response.
@dbuenoparedes We've story 7068 open for this documentation change.

@carchi8py carchi8py added enhancement New feature or request Jira Has an Internal Jira Story labels Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Jira Has an Internal Jira Story
Projects
None yet
Development

No branches or pull requests

4 participants