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

Metrocluster Switchover -Simulate true #192

Closed wagneradrian92 closed 5 months ago

wagneradrian92 commented 7 months ago

Summary

when trying to simulate a metrocluster switchover simulte using netapp.ontap.na_ontap_rest_cli i use the following command:

command: 'metrocluster/switchover' body: action: negotiated_switchover_simulate verb: PATCH

but i always receive the following error: FAILED! => {"changed": false, "msg": "Error: {'message': 'Unexpected argument \"action\".', 'code': '262179', 'target': 'action'}"}

when doing the same call using curl it works. am i missing something in my task or is there a bug in this?

thank you

Component Name

netapp.ontap.na_ontap_rest_cli

Ansible Version

ansible            4.10.0
ansible-core       2.11.12

ONTAP Collection Version

netapp.aws                    21.7.0
netapp.azure                  21.10.0
netapp.cloudmanager           21.12.1
netapp.elementsw              21.7.0
netapp.ontap                  21.14.1
netapp.um_info                21.8.0
netapp_eseries.santricity     1.2.13

ONTAP Version

NetApp Release 9.11.1P6

Playbook

- name: Execute MetroCluster Switchover Simulation Command with rest
    netapp.ontap.na_ontap_rest_cli:
      hostname: "{{ inventory_hostname }}"
      username: "{{ ansible_username }}"
      password: "{{ ansible_password }}"
      #command: ['version']
      command: 'metrocluster/switchover'
      params:
        action: negotiated_switchover_simulate
      https: true
      validate_certs: false
      verb: PATCH

Steps to Reproduce

  - name: Execute MetroCluster Switchover Simulation Command with rest
    netapp.ontap.na_ontap_rest_cli:
      hostname: "{{ inventory_hostname }}"
      username: "{{ ansible_username }}"
      password: "{{ ansible_password }}"
      #command: ['version']
      command: 'metrocluster/switchover'
      params:
        action: negotiated_switchover_simulate
      https: true
      validate_certs: false
      verb: PATCH

Expected Results

switchover simulte successful or failed

Actual Results

fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error: {'message': 'Unexpected argument \"action\".', 'code': '262179', 'target': 'action'}"}
mamoep commented 7 months ago

You are using the wrong module. na_ontap_rest_cli uses the private cli passthrough endpoint. This basically maps to CLI commands. The "metrocluster switchover" command has no parameter called "action".

You should use the module na_ontap_restit where you can directly access REST endpoints, similar to a curl command. https://docs.ansible.com/ansible/devel/collections/netapp/ontap/na_ontap_restit_module.html

wagneradrian92 commented 7 months ago

thank you so much! with the restit module it works!