#snapmirror list-destinations for Ansible?

1 messages · Page 1 of 1 (latest)

serene topaz
#

If I know my source volume, is there a way to pull Snapmirror information for it (similar to the CLI command snapmirror list-destinations) using Ansible?

I can pull relationship info from the destination using na_ontap_rest_info, but I have to know what the destination path is to do that.

reef willow
serene topaz
#

Cool, thank you, @reef willow!

robust birch
#

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 }}"
small crypt
#

Is there a way to release a destination as well?