#snapmirror list-destinations for Ansible?
1 messages · Page 1 of 1 (latest)
@serene topaz hi, as per Swagger docs the corresponding REST API should be below:
https://docs.netapp.com/us-en/ontap-restapi/ontap/swagger-ui/index.html#/SnapMirror/snapmirror_relationships_get
GET "/api/snapmirror/relationships/?list_destinations_only=true"
You can try utilizing module na_ontap_restit
https://docs.ansible.com/ansible/latest/collections/netapp/ontap/na_ontap_restit_module.html#ansible-collections-netapp-ontap-na-ontap-restit-module
Cool, thank you, @reef willow!
Thought I'd share my example on this...
- name: Get snapmirror destination info.
hosts: localhost
collections:
- netapp.ontap
gather_facts: false
vars_files:
- vars/main.yml
- vault/main.yml
vars:
netapp_hostname: cluster_hostname_or_ip
src_vserver: source_vserver
src_volume: source_volume
tasks:
- name: Get snapmirror destinations.
netapp.ontap.na_ontap_restit:
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
https: true
validate_certs: false
api: snapmirror/relationships
query:
list_destinations_only: true
source.path: "{{ src_vserver }}:{{ src_volume }}"
fields: destination.cluster.name,destination.path,destination.svm.name
register: sm_dest_info
- name: Display snapmirror destination info.
ansible.builtin.debug:
# msg: "{{ sm_dest_info }}"
msg:
- "{{ item.destination.cluster.name }}"
- "{{ item.destination.svm.name }}"
- "{{ item.destination.path }}"
loop: "{{ sm_dest_info.response.records }}"
loop_control:
loop_var: item
label: "{{ item.destination.cluster.name }}"
Is there a way to release a destination as well?