summaryrefslogtreecommitdiffstats
path: root/ansible_collections/dellemc/unity/docs/modules/snapshot.rst
blob: 5ef58211473036294f9a6ce10daaea9ef6591723 (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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
.. _snapshot_module:


snapshot -- Manage snapshots on the Unity storage system
========================================================

.. contents::
   :local:
   :depth: 1


Synopsis
--------

Managing snapshots on the Unity storage system includes create snapshot, delete snapshot, update snapshot, get snapshot, map host and unmap host.



Requirements
------------
The below requirements are needed on the host that executes this module.

- A Dell Unity Storage device version 5.1 or later.
- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.



Parameters
----------

  snapshot_name (optional, str, None)
    The name of the snapshot.

    Mandatory parameter for creating a snapshot.

    For all other operations either *snapshot_name* or *snapshot_id* is required.


  vol_name (optional, str, None)
    The name of the volume for which snapshot is created.

    For creation of a snapshot either *vol_name* or *cg_name* is required.

    Not required for other operations.


  cg_name (optional, str, None)
    The name of the Consistency Group for which snapshot is created.

    For creation of a snapshot either *vol_name* or *cg_name* is required.

    Not required for other operations.


  snapshot_id (optional, str, None)
    The id of the snapshot.

    For all operations other than creation either *snapshot_name* or *snapshot_id* is required.


  auto_delete (optional, bool, None)
    This option specifies whether the snapshot is auto deleted or not.

    If set to ``true``, snapshot will expire based on the pool auto deletion policy.

    If set to (false), snapshot will not be auto deleted based on the pool auto deletion policy.

    Option *auto_delete* can not be set to ``true``, if *expiry_time* is specified.

    If during creation neither *auto_delete* nor *expiry_time* is mentioned then snapshot will be created keeping *auto_delete* as ``true``.

    Once the *expiry_time* is set then snapshot cannot be assigned to the auto delete policy.


  expiry_time (optional, str, None)
    This option is for specifying the date and time after which the snapshot will expire.

    The time is to be mentioned in UTC timezone.

    The format is "MM/DD/YYYY HH:MM". Year must be in 4 digits.


  description (optional, str, None)
    The additional information about the snapshot can be provided using this option.


  new_snapshot_name (optional, str, None)
    New name for the snapshot.


  state (True, str, None)
    The *state* option is used to mention the existence of the snapshot.


  host_name (optional, str, None)
    The name of the host.

    Either *host_name* or *host_id* is required to map or unmap a snapshot from a host.

    Snapshot can be attached to multiple hosts.


  host_id (optional, str, None)
    The id of the host.

    Either *host_name* or *host_id* is required to map or unmap a snapshot from a host.

    Snapshot can be attached to multiple hosts.


  host_state (optional, str, None)
    The *host_state* option is used to mention the existence of the host for snapshot.

    It is required when a snapshot is mapped or unmapped from host.


  unispherehost (True, str, None)
    IP or FQDN of the Unity management server.


  username (True, str, None)
    The username of the Unity management server.


  password (True, str, None)
    The password of the Unity management server.


  validate_certs (optional, bool, True)
    Boolean variable to specify whether or not to validate SSL certificate.

    ``true`` - Indicates that the SSL certificate should be verified.

    ``false`` - Indicates that the SSL certificate should not be verified.


  port (optional, int, 443)
    Port number through which communication happens with Unity management server.





Notes
-----

.. note::
   - The *check_mode* is not supported.
   - The modules present in this collection named as 'dellemc.unity' are built to support the Dell Unity storage platform.




Examples
--------

.. code-block:: yaml+jinja

    
      - name: Create a Snapshot for a CG
        dellemc.unity.snapshot:
          unispherehost: "{{unispherehost}}"
          username: "{{username}}"
          password: "{{password}}"
          validate_certs: "{{validate_certs}}"
          port: "{{port}}"
          cg_name: "{{cg_name}}"
          snapshot_name: "{{cg_snapshot_name}}"
          description: "{{description}}"
          auto_delete: False
          state: "present"

      - name: Create a Snapshot for a volume with Host attached
        dellemc.unity.snapshot:
          unispherehost: "{{unispherehost}}"
          username: "{{username}}"
          password: "{{password}}"
          validate_certs: "{{validate_certs}}"
          port: "{{port}}"
          vol_name: "{{vol_name}}"
          snapshot_name: "{{vol_snapshot_name}}"
          description: "{{description}}"
          expiry_time: "04/15/2025 16:30"
          host_name: "{{host_name}}"
          host_state: "mapped"
          state: "present"

      - name: Unmap a host for a Snapshot
        dellemc.unity.snapshot:
          unispherehost: "{{unispherehost}}"
          username: "{{username}}"
          password: "{{password}}"
          validate_certs: "{{validate_certs}}"
          port: "{{port}}"
          snapshot_name: "{{vol_snapshot_name}}"
          host_name: "{{host_name}}"
          host_state: "unmapped"
          state: "present"

      - name: Map snapshot to a host
        dellemc.unity.snapshot:
          unispherehost: "{{unispherehost}}"
          username: "{{username}}"
          password: "{{password}}"
          validate_certs: "{{validate_certs}}"
          port: "{{port}}"
          snapshot_name: "{{vol_snapshot_name}}"
          host_name: "{{host_name}}"
          host_state: "mapped"
          state: "present"

      - name: Update attributes of a Snapshot for a volume
        dellemc.unity.snapshot:
          unispherehost: "{{unispherehost}}"
          username: "{{username}}"
          password: "{{password}}"
          validate_certs: "{{validate_certs}}"
          snapshot_name: "{{vol_snapshot_name}}"
          new_snapshot_name: "{{new_snapshot_name}}"
          description: "{{new_description}}"
          host_name: "{{host_name}}"
          host_state: "unmapped"
          state: "present"

      - name: Delete Snapshot of CG
        dellemc.unity.snapshot:
          unispherehost: "{{unispherehost}}"
          username: "{{username}}"
          password: "{{password}}"
          validate_certs: "{{validate_certs}}"
          snapshot_name: "{{cg_snapshot_name}}"
          state: "absent"



Return Values
-------------

changed (always, bool, True)
  Whether or not the resource has changed.


snapshot_details (When snapshot exists, dict, {'access_type': None, 'attached_wwn': None, 'creation_time': '2022-10-21 08:20:25.803000+00:00', 'creator_schedule': None, 'creator_type': 'SnapCreatorTypeEnum.USER_CUSTOM', 'creator_user': {'id': 'user_admin'}, 'description': 'Test snap creation', 'existed': True, 'expiration_time': None, 'hash': 8756689457056, 'hosts_list': [], 'id': '85899355291', 'io_limit_policy': None, 'is_auto_delete': True, 'is_modifiable': False, 'is_modified': False, 'is_read_only': True, 'is_system_snap': False, 'last_writable_time': None, 'lun': None, 'name': 'ansible_snap_cg_1_1', 'parent_snap': None, 'size': None, 'snap_group': None, 'state': 'SnapStateEnum.READY', 'storage_resource_id': 'res_95', 'storage_resource_name': 'CG_ansible_test_2_new'})
  Details of the snapshot.


  is_auto_delete (, str, )
    Additional information mentioned for snapshot.


  expiration_time (, str, )
    Date and time after which the snapshot will expire.


  hosts_list (, dict, )
    Contains the name and id of the associated hosts.


  id (, str, )
    Unique identifier of the snapshot instance.


  name (, str, )
    The name of the snapshot.


  storage_resource_name (, str, )
    Name of the storage resource for which the snapshot exists.


  storage_resource_id (, str, )
    Id of the storage resource for which the snapshot exists.






Status
------





Authors
~~~~~~~

- P Srinivas Rao (@srinivas-rao5) <ansible.team@dell.com>