| 1 | --- |
| 2 | - name: Using the IBM Storage Virtualize collection For PBR configuration |
| 3 | hosts: localhost |
| 4 | gather_facts: false |
| 5 | connection: local |
| 6 | vars: |
| 7 | ha_partition_name: "{{ clusters[0].partition_name | default(ptn_dr_0) }}" |
| 8 | dr_partition_name: "{{ clusters[1].partition_name | default(ptn_dr_0) }}" |
| 9 | vars_files: |
| 10 | - inventory.ini |
| 11 | tasks: |
| 12 | |
| 13 | - name: Fetch auth token for HA AMS cluster |
| 14 | register: ha_ams_auth |
| 15 | no_log: true |
| 16 | ibm.storage_virtualize.ibm_svc_auth: |
| 17 | clustername: "{{ clusters[0].clustername }}" |
| 18 | username: "{{ clusters[0].username }}" |
| 19 | password: "{{ clusters[0].password }}" |
| 20 | log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" |
| 21 | |
| 22 | - name: Fetch auth token for DR cluster |
| 23 | register: dr_auth |
| 24 | no_log: true |
| 25 | ibm.storage_virtualize.ibm_svc_auth: |
| 26 | clustername: "{{ clusters[1].clustername }}" |
| 27 | username: "{{ clusters[1].username }}" |
| 28 | password: "{{ clusters[1].password }}" |
| 29 | log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" |
| 30 | |
| 31 | - name: Get the pool info |
| 32 | register: pool_results |
| 33 | ibm.storage_virtualize.ibm_svc_info: |
| 34 | clustername: "{{ clusters[0].clustername }}" |
| 35 | token: "{{ ha_ams_auth.token }}" |
| 36 | log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" |
| 37 | gather_subset: "pool" |
| 38 | objectname: "{{ clusters[0].pool_name }}" |
| 39 | |
| 40 | - name: Set replicationpoollinkuid on DR site |
| 41 | ibm.storage_virtualize.ibm_svc_mdiskgrp: |
| 42 | clustername: "{{ clusters[1].clustername }}" |
| 43 | token: "{{ dr_auth.token }}" |
| 44 | log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" |
| 45 | name: "{{ clusters[1].pool_name }}" |
| 46 | state: "present" |
| 47 | replicationpoollinkuid: "{{ pool_results.Pool.replication_pool_link_uid }}" |
| 48 | replication_partner_clusterid: "{{ clusters[0].name }}" |
| 49 | |
| 50 | - name: Create Storage Partition in DR site |
| 51 | ibm.storage_virtualize.ibm_sv_manage_storage_partition: |
| 52 | clustername: "{{ clusters[1].clustername }}" |
| 53 | token: "{{ dr_auth.token }}" |
| 54 | log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" |
| 55 | name: "{{ dr_partition_name }}" |
| 56 | state: "present" |
| 57 | |
| 58 | - name: Get dr partition info |
| 59 | register: dr_partition_results |
| 60 | ibm.storage_virtualize.ibm_svc_info: |
| 61 | clustername: "{{ clusters[1].clustername }}" |
| 62 | token: "{{ dr_auth.token }}" |
| 63 | log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" |
| 64 | gather_subset: "partition" |
| 65 | objectname: "{{ dr_partition_name }}" |
| 66 | |
| 67 | - name: Add dr-link to HA1 Storage Partition |
| 68 | ibm.storage_virtualize.ibm_sv_manage_storage_partition: |
| 69 | clustername: "{{ clusters[0].clustername }}" |
| 70 | token: "{{ ha_ams_auth.token }}" |
| 71 | log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" |
| 72 | name: "{{ ha_partition_name }}" |
| 73 | state: "present" |
| 74 | drlink_partition_uuid: "{{ dr_partition_results.Partition.uuid }}" |
| 75 | remotesystem: "{{ clusters[1].name }}" |
| 76 | |
| 77 | - name: Create async-dr replication policy in HA1 stoarge |
| 78 | ibm.storage_virtualize.ibm_sv_manage_replication_policy: |
| 79 | clustername: "{{ clusters[0].clustername }}" |
| 80 | token: "{{ ha_ams_auth.token }}" |
| 81 | log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" |
| 82 | name: "{{ dr_policy_name }}" |
| 83 | topology: async-dr |
| 84 | partition: "{{ ha_partition_name }}" |
| 85 | rpoalert: 60 |
| 86 | state: present |
| 87 | |
| 88 | - name: Add dr replicationpolicy to existing volumegroups. |
| 89 | ibm.storage_virtualize.ibm_svc_manage_volumegroup: |
| 90 | clustername: "{{ clusters[0].clustername }}" |
| 91 | token: "{{ ha_ams_auth.token }}" |
| 92 | log_path: "{{ log_path | default('/tmp/ansiblePB.debug') }}" |
| 93 | name: "{{ item }}" |
| 94 | state: "present" |
| 95 | replicationpolicy: "{{ dr_policy_name }}" |
| 96 | loop: "{{ volume_group_name }}" |