| 1 | --- |
| 2 | - name: Using IBM Storage Virtualize collection to create rc consistency group |
| 3 | hosts: localhost |
| 4 | gather_facts: false |
| 5 | vars: |
| 6 | auxcluster: 'x.x.x.x' |
| 7 | ausername: 'ausername' |
| 8 | apassword: 'apassword' |
| 9 | clustername: 'clustername' |
| 10 | username: 'username' |
| 11 | password: 'password' |
| 12 | cgname: 'Group_cg11' |
| 13 | remotecluster: 'Cluster_x.x.x.x' |
| 14 | masterpool: 'site1pool1' |
| 15 | mastervol: 'master' |
| 16 | relname: 'scopy5' |
| 17 | auxvol: 'auxvol' |
| 18 | connection: local |
| 19 | tasks: |
| 20 | - name: Fetch authorization token for aux |
| 21 | register: auth |
| 22 | no_log: true |
| 23 | ibm.storage_virtualize.ibm_svc_auth: |
| 24 | clustername: "{{ auxcluster }}" |
| 25 | username: "{{ ausername }}" |
| 26 | password: "{{ apassword }}" |
| 27 | - name: Create target volume |
| 28 | ibm.storage_virtualize.ibm_svc_manage_volume: |
| 29 | clustername: "{{ auxcluster }}" |
| 30 | token: "{{ auth.token }}" |
| 31 | pool: "{{ auxpool }}" |
| 32 | name: "{{ auxvol }}" |
| 33 | size: 10 |
| 34 | unit: "gb" |
| 35 | state: present |
| 36 | - name: Fetch authorization token for master |
| 37 | register: results |
| 38 | no_log: true |
| 39 | ibm.storage_virtualize.ibm_svc_auth: |
| 40 | clustername: "{{ clustername }}" |
| 41 | username: "{{ username }}" |
| 42 | password: "{{ password }}" |
| 43 | - name: Create remote copy cg |
| 44 | ibm.storage_virtualize.ibm_svc_manage_replicationgroup: |
| 45 | name: "{{ cgname }}" |
| 46 | clustername: "{{ clustername }}" |
| 47 | token: "{{ results.token }}" |
| 48 | state: present |
| 49 | remotecluster: "{{ remotecluster }}" |
| 50 | - name: Create source volume |
| 51 | ibm.storage_virtualize.ibm_svc_manage_volume: |
| 52 | clustername: "{{ clustername }}" |
| 53 | token: "{{ results.token }}" |
| 54 | pool: "{{ masterpool }}" |
| 55 | name: "{{ mastervol }}" |
| 56 | size: 1 |
| 57 | unit: "gb" |
| 58 | state: present |
| 59 | - name: Create MM remote copy |
| 60 | ibm.storage_virtualize.ibm_svc_manage_replication: |
| 61 | name: "{{ relname }}" |
| 62 | clustername: "{{ clustername }}" |
| 63 | token: "{{ results.token }}" |
| 64 | state: present |
| 65 | remotecluster: "{{ remotecluster }}" |
| 66 | master: "{{ mastervol }}" |
| 67 | aux: "{{ auxvol }}" |
| 68 | copytype: metro |
| 69 | sync: true |
| 70 | consistgrp: "{{ cgname }}" |
| 71 | - name: Remove the remote copy from CG |
| 72 | ibm.storage_virtualize.ibm_svc_manage_replication: |
| 73 | name: "{{ relname }}" |
| 74 | clustername: "{{ clustername }}" |
| 75 | token: "{{ results.token }}" |
| 76 | state: present |
| 77 | remotecluster: "{{ remotecluster }}" |
| 78 | master: "{{ mastervol }}" |
| 79 | aux: "{{ auxvol }}" |
| 80 | copytype: metro |
| 81 | noconsistgrp: true |
| 82 | - name: Convert MM to GM |
| 83 | ibm.storage_virtualize.ibm_svc_manage_replication: |
| 84 | name: "{{ relname }}" |
| 85 | clustername: "{{ clustername }}" |
| 86 | token: "{{ results.token }}" |
| 87 | state: present |
| 88 | remotecluster: "{{ remotecluster }}" |
| 89 | master: "{{ mastervol }}" |
| 90 | aux: "{{ auxvol }}" |
| 91 | copytype: global |
| 92 | - name: Convert GM to GMCV |
| 93 | ibm.storage_virtualize.ibm_svc_manage_replication: |
| 94 | name: "{{ relname }}" |
| 95 | clustername: "{{ clustername }}" |
| 96 | token: "{{ results.token }}" |
| 97 | state: present |
| 98 | remotecluster: "{{ remotecluster }}" |
| 99 | master: "{{ mastervol }}" |
| 100 | aux: "{{ auxvol }}" |
| 101 | copytype: GMCV |
| 102 | consistgrp: "{{ cgname }}" |
| 103 | - name: Create/attach master change volume |
| 104 | ibm.storage_virtualize.ibm_svc_manage_cv: |
| 105 | clustername: "{{ clustername }}" |
| 106 | token: "{{ results.token }}" |
| 107 | state: present |
| 108 | rname: "{{ relname }}" |
| 109 | cvname: "{{ mastervolcv }}" |
| 110 | basevolume: "{{ mastervol }}" |
| 111 | - name: Create/attach aux change volume |
| 112 | ibm.storage_virtualize.ibm_svc_manage_cv: |
| 113 | clustername: "{{ auxcluster }}" |
| 114 | token: "{{ auth.token }}" |
| 115 | state: present |
| 116 | rname: "{{ relname }}" |
| 117 | cvname: "{{ auxvolcv }}" |
| 118 | basevolume: "{{ auxvol }}" |
| 119 | ismaster: false |