summaryrefslogtreecommitdiffstats
path: root/ansible_collections/dellemc/unity/playbooks/modules/consistencygroup.yml
blob: f183304bac20b52b2a0059a9250a19159f875203 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
---
- name: Consistency Group Operations
  hosts: localhost
  connection: local
  vars:
    unispherehost: '10.*.*.*'
    validate_certs: false
    username: 'user'
    password: '***'
    cg_name: 'Ansible_CG_Testing'
    new_cg_name: 'Ansible_CG_Rename_Testing'
    description: "Ansible demo"
    snap_schedule1: "Ansible_Test"
    snap_schedule2: "CG_test_schedule"
    tiering_policy1: "LOWEST"
    state_present: "present"
    state_absent: "absent"
    vol_state_present: "present-in-group"
    vol_state_absent: "absent-in-group"
    mapping_state_present: "mapped"
    mapping_state_absent: "unmapped"

  tasks:
    - name: Create consistency group with volume and host access
      register: result_cg
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        validate_certs: "{{ validate_certs }}"
        username: "{{ username }}"
        password: "{{ password }}"
        cg_name: "{{ cg_name }}"
        description: "{{ description }}"
        snap_schedule: "{{ snap_schedule1 }}"
        volumes:
          - vol_name: "Test_cg_vol-1"
        vol_state: "{{ vol_state_present }}"
        hosts:
          - host_name: "10.*.*.*"
          - host_id: "Host_511"
        mapping_state: "{{ mapping_state_present }}"
        state: "{{ state_present }}"

    - name: Set cg_id
      ansible.builtin.set_fact:
        cg_id: "{{ result_cg.consistency_group_details.id }}"

    - name: Get details of consistency group using id
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }} "
        cg_id: "{{ cg_id }}"
        state: "{{ state_present }}"

    - name: Add volumes to consistency group
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_id: "{{ cg_id }}"
        volumes:
          - vol_name: "Test_cg_vol-2"
          - vol_id: "sv_8984"
        vol_state: "{{ vol_state_present }}"
        state: "{{ state_present }}"

    - name: Add volumes to consistency group - Idempotency
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_id: "{{ cg_id }}"
        volumes:
          - vol_name: "Test_cg_vol-2"
          - vol_id: "sv_8984"
        vol_state: "{{ vol_state_present }}"
        state: "{{ state_present }}"

    - name: Rename consistency group
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_name: "{{ cg_name }}"
        new_cg_name: "{{ new_cg_name }}"
        state: "{{ state_present }}"

    - name: Rename consistency group - Idempotency
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_name: "{{ new_cg_name }}"
        new_cg_name: "{{ new_cg_name }}"
        state: "{{ state_present }}"

    - name: Modify consistency group details
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_name: "{{ new_cg_name }}"
        snap_schedule: "{{ snap_schedule2 }}"
        tiering_policy: "{{ tiering_policy1 }}"
        state: "{{ state_present }}"

    - name: Modify consistency group details - Idempotency
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_name: "{{ new_cg_name }}"
        snap_schedule: "{{ snap_schedule2 }}"
        tiering_policy: "{{ tiering_policy1 }}"
        state: "{{ state_present }}"

    - name: Map host to consistency group
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_name: "{{ new_cg_name }}"
        hosts:
          - host_name: "10.*.*.*"
        mapping_state: "{{ mapping_state_present }}"
        state: "{{ state_present }}"

    - name: Map host to consistency group -- Idempotency
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_name: "{{ new_cg_name }}"
        hosts:
          - host_name: "10.*.*.*"
        mapping_state: "{{ mapping_state_present }}"
        state: "{{ state_present }}"

    - name: Unmap host to consistency group
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_name: "{{ new_cg_name }}"
        hosts:
          - host_name: "10.*.*.*"
          - host_id: "Host_511"
        mapping_state: "{{ mapping_state_absent }}"
        state: "{{ state_present }}"

    - name: Unmap host to consistency group -- Idempotency
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_name: "{{ new_cg_name }}"
        hosts:
          - host_name: "10.*.*.*"
          - host_id: "Host_511"
        mapping_state: "{{ mapping_state_absent }}"
        state: "{{ state_present }}"

    - name: Remove volumes from consistency group
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_name: "{{ new_cg_name }}"
        volumes:
          - vol_name: "Test_cg_vol-1"
          - vol_name: "Test_cg_vol-2"
          - vol_id: "sv_8984"
        vol_state: "{{ vol_state_absent }}"
        state: "{{ state_present }}"

    - name: Remove volumes from consistency group - Idempotency
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_name: "{{ new_cg_name }}"
        volumes:
          - vol_name: "Test_cg_vol-1"
          - vol_name: "Test_cg_vol-2"
          - vol_id: "sv_8984"
        vol_state: "{{ vol_state_absent }}"
        state: "{{ state_present }}"

    - name: Delete consistency group
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_name: "{{ new_cg_name }}"
        state: "{{ state_absent }}"

    - name: Delete consistency group Idempotency
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_name: "{{ new_cg_name }}"
        state: "{{ state_absent }}"

    - name: Enable replication for consistency group
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_name: "dis_repl_ans_source"
        replication_params:
          destination_cg_name: "destination_dis_repl_ans_source"
          replication_mode: "asynchronous"
          rpo: 60
          replication_type: "remote"
          remote_system:
            remote_system_host: '10.*.*.*'
            remote_system_verifycert: false
            remote_system_username: 'user'
            remote_system_password: '**'
          destination_pool_name: "Extreme_Perf_tier"
        replication_state: "enable"
        state: "present"

    - name: Disable replication for consistency group
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_name: "dis_repl_ans_source"
        replication_state: "disable"
        state: "present"

    - name: Disable replication for consistency group Idempotency
      dellemc.unity.consistencygroup:
        unispherehost: "{{ unispherehost }}"
        username: "{{ username }}"
        password: "{{ password }}"
        validate_certs: "{{ validate_certs }}"
        cg_name: "dis_repl_ans_source"
        replication_state: "disable"
        state: "present"