Debian Codegraph @

ansible_collections/dellemc/unity/playbooks/modules/snapshot.yml

raw symbols SCIP
1 ---
2 - name: Snapshot Module Operations in Unity
3 hosts: localhost
4 connection: local
5 vars:
6 unispherehost: '10.*.*.*'
7 validate_certs: false
8 username: 'admin'
9 password: 'Password123!'
10 cg_snapshot_name: "ansible_snap_cg_1_1"
11 vol_snapshot_name: "ansible_snap_lun_4_2"
12 vol_name: "ansible_snap_lun_4"
13 cg_name: "ansible_snap_cg_1"
14 description: "Created using playbook"
15 new_description: "modified description using playbook"
16 host_name: "ansible_snap_host"
17 expiry_time: "04/15/2021 2:30"
18 new_expiry_time: "04/10/2021 2:30"
19 new_snapshot_name: "new_ansible_snap_lun_4_2"
20
21 tasks:
22 - name: Create a Snapshot for a CG
23 register: result
24 snapshot:
25 unispherehost: "{{ unispherehost }}"
26 username: "{{ username }}"
27 password: "{{ password }}"
28 validate_certs: "{{ validate_certs }}"
29 port: "{{ port }}"
30 cg_name: "{{ cg_name }}"
31 snapshot_name: "{{ cg_snapshot_name }}"
32 description: "{{ description }}"
33 auto_delete: false
34 state: "present"
35
36 - name: Set snapshot id
37 ansible.builtin.set_fact:
38 cg_snapshot_id: "{{ result.snapshot_details.id }}"
39
40 - name: Create a Snapshot for a CG Idempotency
41 snapshot:
42 unispherehost: "{{ unispherehost }}"
43 username: "{{ username }}"
44 password: "{{ password }}"
45 validate_certs: "{{ validate_certs }}"
46 port: "{{ port }}"
47 cg_name: "{{ cg_name }}"
48 snapshot_name: "{{ cg_snapshot_name }}"
49 description: "{{ description }}"
50 auto_delete: false
51 state: "present"
52
53 - name: Create a Snapshot for a LUN with Host attached.
54 register: result
55 snapshot:
56 unispherehost: "{{ unispherehost }}"
57 username: "{{ username }}"
58 password: "{{ password }}"
59 validate_certs: "{{ validate_certs }}"
60 port: "{{ port }}"
61 vol_name: "{{ vol_name }}"
62 snapshot_name: "{{ vol_snapshot_name }}"
63 expiry_time: "{{ expiry_time }}"
64 description: "{{ description }}"
65 host_name: "{{ host_name }}"
66 host_state: "mapped"
67 state: "present"
68
69 - name: Set snapshot id for LUN
70 ansible.builtin.set_fact:
71 vol_snapshot_id: "{{ result.snapshot_details.id }}"
72
73 - name: Create a Snapshot for a LUN with Host attached Idempotency.
74 snapshot:
75 unispherehost: "{{ unispherehost }}"
76 username: "{{ username }}"
77 password: "{{ password }}"
78 validate_certs: "{{ validate_certs }}"
79 port: "{{ port }}"
80 vol_name: "{{ vol_name }}"
81 snapshot_name: "{{ vol_snapshot_name }}"
82 expiry_time: "{{ expiry_time }}"
83 description: "{{ description }}"
84 host_name: "{{ host_name }}"
85 host_state: "mapped"
86 state: "present"
87
88 - name: Unmap a host for a Snapshot using Id
89 snapshot:
90 unispherehost: "{{ unispherehost }}"
91 username: "{{ username }}"
92 password: "{{ password }}"
93 validate_certs: "{{ validate_certs }}"
94 port: "{{ port }}"
95 snapshot_id: "{{ vol_snapshot_id }}"
96 host_name: "{{ host_name }}"
97 host_state: "unmapped"
98 state: "present"
99
100 - name: Unmap a host for a Snapshot Idempotency case
101 snapshot:
102 unispherehost: "{{ unispherehost }}"
103 username: "{{ username }}"
104 password: "{{ password }}"
105 validate_certs: "{{ validate_certs }}"
106 port: "{{ port }}"
107 snapshot_name: "{{ vol_snapshot_name }}"
108 host_name: "{{ host_name }}"
109 host_state: "unmapped"
110 state: "present"
111
112 - name: Map snapshot to a host using Id
113 snapshot:
114 unispherehost: "{{ unispherehost }}"
115 username: "{{ username }}"
116 password: "{{ password }}"
117 validate_certs: "{{ validate_certs }}"
118 port: "{{ port }}"
119 snapshot_id: "{{ vol_snapshot_id }}"
120 host_name: "{{ host_name }}"
121 host_state: "mapped"
122 state: "present"
123
124 - name: Get Snapshot Details using Id
125 snapshot:
126 unispherehost: "{{ unispherehost }}"
127 username: "{{ username }}"
128 password: "{{ password }}"
129 validate_certs: "{{ validate_certs }}"
130 snapshot_id: "{{ cg_snapshot_id }}"
131 state: "present"
132
133 - name: Update attributes of a Snapshot for a LUN using Id
134 snapshot:
135 unispherehost: "{{ unispherehost }}"
136 username: "{{ username }}"
137 password: "{{ password }}"
138 validate_certs: "{{ validate_certs }}"
139 snapshot_id: "{{ vol_snapshot_id }}"
140 new_snapshot_name: "{{ new_snapshot_name }}"
141 expiry_time: "{{ new_expiry_time }}"
142 description: "{{ new_description }}"
143 host_name: "{{ host_name }}"
144 host_state: "unmapped"
145 state: "present"
146
147 - name: Update attributes of a Snapshot for a LUN Idempotency case
148 snapshot:
149 unispherehost: "{{ unispherehost }}"
150 username: "{{ username }}"
151 password: "{{ password }}"
152 validate_certs: "{{ validate_certs }}"
153 snapshot_name: "{{ new_snapshot_name }}"
154 expiry_time: "{{ new_expiry_time }}"
155 description: "{{ new_description }}"
156 host_name: "{{ host_name }}"
157 host_state: "unmapped"
158 state: "present"
159
160 - name: Delete Snapshot of CG.
161 snapshot:
162 unispherehost: "{{ unispherehost }}"
163 username: "{{ username }}"
164 password: "{{ password }}"
165 validate_certs: "{{ validate_certs }}"
166 snapshot_name: "{{ cg_snapshot_name }}"
167 state: "absent"
168
169 - name: Delete Snapshot of CG using Id Idempotency case.
170 snapshot:
171 unispherehost: "{{ unispherehost }}"
172 username: "{{ username }}"
173 password: "{{ password }}"
174 validate_certs: "{{ validate_certs }}"
175 snapshot_id: "{{ cg_snapshot_id }}"
176 state: "absent"
177
178 - name: Delete Snapshot of volume.
179 snapshot:
180 unispherehost: "{{ unispherehost }}"
181 username: "{{ username }}"
182 password: "{{ password }}"
183 validate_certs: "{{ validate_certs }}"
184 snapshot_name: "{{ new_snapshot_name }}"
185 state: "absent"
186
187 - name: Delete Snapshot of volume Idempotency.
188 snapshot:
189 unispherehost: "{{ unispherehost }}"
190 username: "{{ username }}"
191 password: "{{ password }}"
192 validate_certs: "{{ validate_certs }}"
193 snapshot_name: "{{ new_snapshot_name }}"
194 state: "absent"