- name: Using the IBM Storage Virtualize collection For PBR configuration
  hosts: localhost
  gather_facts: false
  connection: local
  vars:
    dr_partition_name: "{{ clusters[1].partition_name | default(ptn_dr_0) }}"
  vars_files:
    - inventory.ini
  tasks:
    - name: Remove replication policy from VG
      ibm.storage_virtualize.ibm_svc_manage_volumegroup:
        clustername: "{{ clusters[0].clustername }}"
        username: "{{ clusters[0].username }}"
        password: "{{ clusters[0].password }}"
        log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}"
        name: "{{ item }}"
        state: "present"
        nodrreplication: true
      loop: "{{ volume_group_name }}"

    - name: Remove dr-link from HA1 Storage Partition
      ibm.storage_virtualize.ibm_sv_manage_storage_partition:
        clustername: "{{ clusters[0].clustername }}"
        username: "{{ clusters[0].username }}"
        password: "{{ clusters[0].password }}"
        log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}"
        name: "{{ clusters[0].partition_name }}"
        state: "present"
        removedrlink: true

    - name: Remove Storage Partition from DR site
      ibm.storage_virtualize.ibm_sv_manage_storage_partition:
        clustername: "{{ clusters[1].clustername }}"
        username: "{{ clusters[1].username }}"
        password: "{{ clusters[1].password }}"
        log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}"
        name: "{{ dr_partition_name }}"
        state: "absent"
