--- - hosts: localhost connection: local gather_facts: false tasks: - name: Stop source SVM netapp.ontap.na_ontap_command: hostname: "{{ source_cluster }}" username: '{{ lookup("env", "ANSIBLE_NET_USERNAME") }}' password: '{{ lookup("env", "ANSIBLE_NET_PASSWORD") }}' https: yes validate_certs: no command: "vserver stop {{source_svm}}" - name: Update Snapmirror netapp.ontap.na_ontap_snapmirror: hostname: "{{ destination_cluster }}" username: '{{ lookup("env", "ANSIBLE_NET_USERNAME") }}' password: '{{ lookup("env", "ANSIBLE_NET_PASSWORD") }}' validate_certs: no https: true state: present update: true destination_path: "{{ destination_svm }}{{':'}}" source_path: "{{ source_svm }}{{':'}}" - name: Check Snapmirror State netapp.ontap.na_ontap_info: hostname: "{{ destination_cluster }}" username: '{{ lookup("env", "ANSIBLE_NET_USERNAME") }}' password: '{{ lookup("env", "ANSIBLE_NET_PASSWORD") }}' validate_certs: no https: true gather_subset: snapmirror_info register: snapstatus until: snapstatus.ontap_info.snapmirror_info['{{destination_svm}}:'].relationship_status == 'idle' retries: 18 delay: 10 - name: Quiesce Snapmirror Relationship netapp.ontap.na_ontap_command: hostname: "{{ destination_cluster }}" username: '{{ lookup("env", "ANSIBLE_NET_USERNAME") }}' password: '{{ lookup("env", "ANSIBLE_NET_PASSWORD") }}' command: "snapmirror quiesce -destination-path {{ destination_svm }}{{':'}}" https: yes validate_certs: no - name: Check Snapmirror Quiesce State netapp.ontap.na_ontap_info: hostname: "{{ destination_cluster }}" username: '{{ lookup("env", "ANSIBLE_NET_USERNAME") }}' password: '{{ lookup("env", "ANSIBLE_NET_PASSWORD") }}' validate_certs: no https: true gather_subset: snapmirror_info register: snapstatus until: snapstatus.ontap_info.snapmirror_info['{{destination_svm}}:'].relationship_status == 'quiesced' retries: 18 delay: 10 - name: Break Snapmirror netapp.ontap.na_ontap_snapmirror: hostname: "{{ destination_cluster }}" username: '{{ lookup("env", "ANSIBLE_NET_USERNAME") }}' password: '{{ lookup("env", "ANSIBLE_NET_PASSWORD") }}' https: yes validate_certs: no state: present relationship_state: broken destination_path: "{{ destination_svm }}{{':'}}" source_path: "{{ source_svm }}{{':'}}" - name: Check Snapmirror Break State netapp.ontap.na_ontap_info: hostname: "{{ destination_cluster }}" username: '{{ lookup("env", "ANSIBLE_NET_USERNAME") }}' password: '{{ lookup("env", "ANSIBLE_NET_PASSWORD") }}' validate_certs: no https: true gather_subset: snapmirror_info register: snapstatus until: snapstatus.ontap_info.snapmirror_info['{{destination_svm}}:'].mirror_state == 'broken-off' retries: 18 delay: 60 - name: Start destination SVM netapp.ontap.na_ontap_command: hostname: "{{ destination_cluster }}" username: '{{ lookup("env", "ANSIBLE_NET_USERNAME") }}' password: '{{ lookup("env", "ANSIBLE_NET_PASSWORD") }}' https: yes validate_certs: no command: "vserver start {{ destination_svm }}" - name: Reverse Resync Snapmirror netapp.ontap.na_ontap_snapmirror: hostname: "{{ source_cluster }}" username: '{{ lookup("env", "ANSIBLE_NET_USERNAME") }}' password: '{{ lookup("env", "ANSIBLE_NET_PASSWORD") }}' validate_certs: no https: true state: present relationship_state: active update: true destination_path: "{{ source_svm }}{{':'}}" source_path: "{{ destination_svm }}{{':'}}"