ansible-collections / netapp.ontap

Ansible collection to support NetApp ONTAP configuration.
https://galaxy.ansible.com/netapp/ontap
GNU General Public License v3.0
51 stars 34 forks source link

na_ontap_net_route failes in check mode if SVM doesn't exist #161

Closed ipm79 closed 2 months ago

ipm79 commented 1 year ago

Summary

When you have a task that uses the netapp.ontap.na_ontap_net_routes module to add a network route the task fails in check-mode if the SVM does not exist. This is a problem for playbooks that are supposed to create a new SVM since the SVM is not created in check mode.

Component Name

netapp.ontap.na_ontap_net_routes

Ansible Version

$ ansible --version
ansible [core 2.15.0]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/ansible/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ansible/.cache/pypoetry/virtualenvs/ansible-muCBpk-I-py3.10/lib/python3.10/site-packages/ansible
  ansible collection location = /home/ansible/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/ansible/.cache/pypoetry/virtualenvs/ansible-muCBpk-I-py3.10/bin/ansible
  python version = 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] (/home/ansible/.cache/pypoetry/virtualenvs/ansible-muCBpk-I-py3.10/bin/python)
  jinja version = 3.1.2
  libyaml = True

ONTAP Collection Version

$ ansible-galaxy collection list
# /home/ansible/.ansible/collections/ansible_collections
Collection                    Version
----------------------------- -------
anatomicjc.passbolt           0.0.11 

# /home/ansible/.cache/pypoetry/virtualenvs/ansible-muCBpk-I-py3.10/lib/python3.10/site-packages/ansible_collections
Collection                    Version
----------------------------- -------
amazon.aws                    6.0.1  
ansible.netcommon             5.1.1  
ansible.posix                 1.5.4  
ansible.utils                 2.10.3 
ansible.windows               1.14.0 
arista.eos                    6.0.1  
awx.awx                       22.2.0 
azure.azcollection            1.15.0 
check_point.mgmt              5.0.0  
chocolatey.chocolatey         1.4.0  
cisco.aci                     2.6.0  
cisco.asa                     4.0.0  
cisco.dnac                    6.7.2  
cisco.intersight              1.0.27 
cisco.ios                     4.5.0  
cisco.iosxr                   5.0.2  
cisco.ise                     2.5.12 
cisco.meraki                  2.15.1 
cisco.mso                     2.4.0  
cisco.nso                     1.0.3  
cisco.nxos                    4.3.0  
cisco.ucs                     1.8.0  
cloud.common                  2.1.3  
cloudscale_ch.cloud           2.2.4  
community.aws                 6.0.0  
community.azure               2.0.0  
community.ciscosmb            1.0.5  
community.crypto              2.13.1 
community.digitalocean        1.23.0 
community.dns                 2.5.4  
community.docker              3.4.6  
community.fortios             1.0.0  
community.general             7.0.1  
community.google              1.0.0  
community.grafana             1.5.4  
community.hashi_vault         5.0.0  
community.hrobot              1.8.0  
community.libvirt             1.2.0  
community.mongodb             1.5.2  
community.mysql               3.7.1  
community.network             5.0.0  
community.okd                 2.3.0  
community.postgresql          2.4.1  
community.proxysql            1.5.1  
community.rabbitmq            1.2.3  
community.routeros            2.8.0  
community.sap                 1.0.0  
community.sap_libs            1.4.1  
community.skydive             1.0.0  
community.sops                1.6.1  
community.vmware              3.6.0  
community.windows             1.13.0 
community.zabbix              2.0.0  
containers.podman             1.10.1 
cyberark.conjur               1.2.0  
cyberark.pas                  1.0.19 
dellemc.enterprise_sonic      2.0.0  
dellemc.openmanage            7.5.0  
dellemc.powerflex             1.6.0  
dellemc.unity                 1.6.0  
f5networks.f5_modules         1.24.0 
fortinet.fortimanager         2.1.7  
fortinet.fortios              2.2.3  
frr.frr                       2.0.2  
gluster.gluster               1.0.2  
google.cloud                  1.1.3  
grafana.grafana               2.0.0  
hetzner.hcloud                1.11.0 
hpe.nimble                    1.1.4  
ibm.qradar                    2.1.0  
ibm.spectrum_virtualize       1.12.0 
infinidat.infinibox           1.3.12 
infoblox.nios_modules         1.5.0  
inspur.ispim                  1.3.0  
inspur.sm                     2.3.0  
junipernetworks.junos         5.1.0  
kubernetes.core               2.4.0  
lowlydba.sqlserver            2.0.0  
microsoft.ad                  1.1.0  
netapp.aws                    21.7.0 
netapp.azure                  21.10.0
netapp.cloudmanager           21.22.0
netapp.elementsw              21.7.0 
netapp.ontap                  22.6.0 
netapp.storagegrid            21.11.1
netapp.um_info                21.8.0 
netapp_eseries.santricity     1.4.0  
netbox.netbox                 3.13.0 
ngine_io.cloudstack           2.3.0  
ngine_io.exoscale             1.0.0  
ngine_io.vultr                1.1.3  
openstack.cloud               2.1.0  
openvswitch.openvswitch       2.1.1  
ovirt.ovirt                   3.1.2  
purestorage.flasharray        1.18.0 
purestorage.flashblade        1.11.0 
purestorage.fusion            1.4.2  
sensu.sensu_go                1.13.2 
servicenow.servicenow         1.0.6  
splunk.es                     2.1.0  
t_systems_mms.icinga_director 1.32.2 
theforeman.foreman            3.10.0 
vmware.vmware_rest            2.3.1  
vultr.cloud                   1.7.1  
vyos.vyos                     4.0.2  
wti.remote                    1.0.4  

# /usr/share/ansible/collections/ansible_collections
Collection                    Version
----------------------------- -------
anatomicjc.passbolt           0.0.11 
netapp.elementsw              21.7.0 
netapp.ontap                  22.6.0

ONTAP Version

sridharc-vsim34::> version
NetApp Release 9.12.1P2: Wed Apr 05 19:57:43 UTC 2023

Playbook

- name: Configure routing for {{ vserver }}
  tags:
  - lif
  - route
  netapp.ontap.na_ontap_net_routes:
    hostname: "{{ netapp_login.hostname }}"
    username: "{{ netapp_login.username }}"
    password: "{{ netapp_login.password }}"
    https: "{{ netapp_login.https }}"
    validate_certs: "{{ netapp_login.validate_certs }}"

    state: present
    vserver: vserver_that_doesnt_exist
    destination: 0.0.0.0/0
    gateway: 1.2.3.4

Steps to Reproduce

Expected Results

Expected output:

changed: [hostname] => {"actions": "create", "changed": true}

Actual Results

fatal: [hostname]: FAILED! => {"changed": false, "msg": "Error fetching net route: calling: network/ip/routes: got {'message': 'SVM \"vserver_that_doesnt_exist\" does not exist. ', 'code': '2621462', 'target': 'svm.name'}."}
carchi8py commented 11 months ago

I'm not 100% sure what the error is here.

The module will fail both in check mode or outside of check mode if the SVM doesn't exist.

na_ontap_net_routes doesn't create an SVM.