Closed autocoder10 closed 3 years ago
@autocoder10 does the resetit module (https://docs.ansible.com/ansible/2.10/collections/netapp/ontap/na_ontap_restit_module.html#ansible-collections-netapp-ontap-na-ontap-restit-module) cover what your looking to do?
That module doesn't cover the one i;m looking for. Basically I want to delete the snapmirror relationship between source and destination volume. In order to do that I have to mention the destination path for the source volume.
- name: Delete SnapMirror
na_ontap_snapmirror:
state: absent
**destination_path: <path>**
relationship_info_only: True
source_hostname: "{{ source_hostname }}"
hostname: "{{ destination_cluster_hostname }}"
username: "{{ destination_cluster_username }}"
password: "{{ destination_cluster_password }}"
@autocoder10 I worked on something similar the other day and na_ontap_zapit
module will get list-destinations
info for you:
- name: Check for snapmirror
netapp.ontap.na_ontap_zapit:
https: yes
validate_certs: no
username: "{{ ntap_username }}"
password: "{{ ntap_password }}"
hostname: "{{ ntap_hostname }}"
zapi:
snapmirror-get-destination-iter:
query:
snapmirror-destination-info:
source-volume: "{{ src_volume }}"
source-vserver: "{{ src_vserver }}"
register: list_sm_zapi
the registered output will give you some data you can work with, for instance:
- name: Set SM destinations
set_fact:
sm_destinations: "{{ [list_sm_zapi.response['attributes-list']['snapmirror-destination-info']] | flatten }}"
when: list_sm_zapi.response['num-records']|int > 0
- debug:
msg: "{{ sm_destinations }}"
when: sm_destinations is defined
Hope this helps
Ok cool. Will give it a shot. Thanks @dprts for sharing.
It worked. @dprts Thanks again for sharing!!
SUMMARY
We are looking to automate snapmirror list-destinations command using REST API instead of SSH command.
ISSUE TYPE
COMPONENT NAME
na_ontap
ADDITIONAL INFORMATION