| 1 |
.. _snapshot_module: |
| 2 |
|
| 3 |
|
| 4 |
snapshot -- Manage snapshots on the Unity storage system |
| 5 |
======================================================== |
| 6 |
|
| 7 |
.. contents:: |
| 8 |
:local: |
| 9 |
:depth: 1 |
| 10 |
|
| 11 |
|
| 12 |
Synopsis |
| 13 |
-------- |
| 14 |
|
| 15 |
Managing snapshots on the Unity storage system includes create snapshot, delete snapshot, update snapshot, get snapshot, map host and unmap host. |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
Requirements |
| 20 |
------------ |
| 21 |
The below requirements are needed on the host that executes this module. |
| 22 |
|
| 23 |
- A Dell Unity Storage device version 5.1 or later. |
| 24 |
- Ansible-core 2.17 or later. |
| 25 |
- Python 3.11, or 3.12. |
| 26 |
- Storops Python SDK 1.2.12. |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
Parameters |
| 31 |
---------- |
| 32 |
|
| 33 |
snapshot_name (optional, str, None) |
| 34 |
The name of the snapshot. |
| 35 |
|
| 36 |
Mandatory parameter for creating a snapshot. |
| 37 |
|
| 38 |
For all other operations either *snapshot_name* or *snapshot_id* is required. |
| 39 |
|
| 40 |
|
| 41 |
vol_name (optional, str, None) |
| 42 |
The name of the volume for which snapshot is created. |
| 43 |
|
| 44 |
For creation of a snapshot either *vol_name* or *cg_name* is required. |
| 45 |
|
| 46 |
Not required for other operations. |
| 47 |
|
| 48 |
|
| 49 |
cg_name (optional, str, None) |
| 50 |
The name of the Consistency Group for which snapshot is created. |
| 51 |
|
| 52 |
For creation of a snapshot either *vol_name* or *cg_name* is required. |
| 53 |
|
| 54 |
Not required for other operations. |
| 55 |
|
| 56 |
|
| 57 |
snapshot_id (optional, str, None) |
| 58 |
The id of the snapshot. |
| 59 |
|
| 60 |
For all operations other than creation either *snapshot_name* or *snapshot_id* is required. |
| 61 |
|
| 62 |
|
| 63 |
auto_delete (optional, bool, None) |
| 64 |
This option specifies whether the snapshot is auto deleted or not. |
| 65 |
|
| 66 |
If set to ``true``, snapshot will expire based on the pool auto deletion policy. |
| 67 |
|
| 68 |
If set to (false), snapshot will not be auto deleted based on the pool auto deletion policy. |
| 69 |
|
| 70 |
Option *auto_delete* can not be set to ``true``, if *expiry_time* is specified. |
| 71 |
|
| 72 |
If during creation neither *auto_delete* nor *expiry_time* is mentioned then snapshot will be created keeping *auto_delete* as ``true``. |
| 73 |
|
| 74 |
Once the *expiry_time* is set then snapshot cannot be assigned to the auto delete policy. |
| 75 |
|
| 76 |
|
| 77 |
expiry_time (optional, str, None) |
| 78 |
This option is for specifying the date and time after which the snapshot will expire. |
| 79 |
|
| 80 |
The time is to be mentioned in UTC timezone. |
| 81 |
|
| 82 |
The format is "MM/DD/YYYY HH:MM". Year must be in 4 digits. |
| 83 |
|
| 84 |
|
| 85 |
description (optional, str, None) |
| 86 |
The additional information about the snapshot can be provided using this option. |
| 87 |
|
| 88 |
|
| 89 |
new_snapshot_name (optional, str, None) |
| 90 |
New name for the snapshot. |
| 91 |
|
| 92 |
|
| 93 |
state (True, str, None) |
| 94 |
The *state* option is used to mention the existence of the snapshot. |
| 95 |
|
| 96 |
|
| 97 |
host_name (optional, str, None) |
| 98 |
The name of the host. |
| 99 |
|
| 100 |
Either *host_name* or *host_id* is required to map or unmap a snapshot from a host. |
| 101 |
|
| 102 |
Snapshot can be attached to multiple hosts. |
| 103 |
|
| 104 |
|
| 105 |
host_id (optional, str, None) |
| 106 |
The id of the host. |
| 107 |
|
| 108 |
Either *host_name* or *host_id* is required to map or unmap a snapshot from a host. |
| 109 |
|
| 110 |
Snapshot can be attached to multiple hosts. |
| 111 |
|
| 112 |
|
| 113 |
host_state (optional, str, None) |
| 114 |
The *host_state* option is used to mention the existence of the host for snapshot. |
| 115 |
|
| 116 |
It is required when a snapshot is mapped or unmapped from host. |
| 117 |
|
| 118 |
|
| 119 |
unispherehost (True, str, None) |
| 120 |
IP or FQDN of the Unity management server. |
| 121 |
|
| 122 |
|
| 123 |
username (True, str, None) |
| 124 |
The username of the Unity management server. |
| 125 |
|
| 126 |
|
| 127 |
password (True, str, None) |
| 128 |
The password of the Unity management server. |
| 129 |
|
| 130 |
|
| 131 |
validate_certs (optional, bool, True) |
| 132 |
Boolean variable to specify whether or not to validate SSL certificate. |
| 133 |
|
| 134 |
``true`` - Indicates that the SSL certificate should be verified. |
| 135 |
|
| 136 |
``false`` - Indicates that the SSL certificate should not be verified. |
| 137 |
|
| 138 |
|
| 139 |
port (optional, int, 443) |
| 140 |
Port number through which communication happens with Unity management server. |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
Notes |
| 147 |
----- |
| 148 |
|
| 149 |
.. note:: |
| 150 |
- The *check_mode* is not supported. |
| 151 |
- The modules present in this collection named as 'dellemc.unity' are built to support the Dell Unity storage platform. |
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
Examples |
| 157 |
-------- |
| 158 |
|
| 159 |
.. code-block:: yaml+jinja |
| 160 |
|
| 161 |
|
| 162 |
- name: Create a Snapshot for a CG |
| 163 |
snapshot: |
| 164 |
unispherehost: "{{unispherehost}}" |
| 165 |
username: "{{username}}" |
| 166 |
password: "{{password}}" |
| 167 |
validate_certs: "{{validate_certs}}" |
| 168 |
port: "{{port}}" |
| 169 |
cg_name: "{{cg_name}}" |
| 170 |
snapshot_name: "{{cg_snapshot_name}}" |
| 171 |
description: "{{description}}" |
| 172 |
auto_delete: False |
| 173 |
state: "present" |
| 174 |
|
| 175 |
- name: Create a Snapshot for a volume with Host attached |
| 176 |
snapshot: |
| 177 |
unispherehost: "{{unispherehost}}" |
| 178 |
username: "{{username}}" |
| 179 |
password: "{{password}}" |
| 180 |
validate_certs: "{{validate_certs}}" |
| 181 |
port: "{{port}}" |
| 182 |
vol_name: "{{vol_name}}" |
| 183 |
snapshot_name: "{{vol_snapshot_name}}" |
| 184 |
description: "{{description}}" |
| 185 |
expiry_time: "04/15/2025 16:30" |
| 186 |
host_name: "{{host_name}}" |
| 187 |
host_state: "mapped" |
| 188 |
state: "present" |
| 189 |
|
| 190 |
- name: Unmap a host for a Snapshot |
| 191 |
snapshot: |
| 192 |
unispherehost: "{{unispherehost}}" |
| 193 |
username: "{{username}}" |
| 194 |
password: "{{password}}" |
| 195 |
validate_certs: "{{validate_certs}}" |
| 196 |
port: "{{port}}" |
| 197 |
snapshot_name: "{{vol_snapshot_name}}" |
| 198 |
host_name: "{{host_name}}" |
| 199 |
host_state: "unmapped" |
| 200 |
state: "present" |
| 201 |
|
| 202 |
- name: Map snapshot to a host |
| 203 |
snapshot: |
| 204 |
unispherehost: "{{unispherehost}}" |
| 205 |
username: "{{username}}" |
| 206 |
password: "{{password}}" |
| 207 |
validate_certs: "{{validate_certs}}" |
| 208 |
port: "{{port}}" |
| 209 |
snapshot_name: "{{vol_snapshot_name}}" |
| 210 |
host_name: "{{host_name}}" |
| 211 |
host_state: "mapped" |
| 212 |
state: "present" |
| 213 |
|
| 214 |
- name: Update attributes of a Snapshot for a volume |
| 215 |
snapshot: |
| 216 |
unispherehost: "{{unispherehost}}" |
| 217 |
username: "{{username}}" |
| 218 |
password: "{{password}}" |
| 219 |
validate_certs: "{{validate_certs}}" |
| 220 |
snapshot_name: "{{vol_snapshot_name}}" |
| 221 |
new_snapshot_name: "{{new_snapshot_name}}" |
| 222 |
description: "{{new_description}}" |
| 223 |
host_name: "{{host_name}}" |
| 224 |
host_state: "unmapped" |
| 225 |
state: "present" |
| 226 |
|
| 227 |
- name: Delete Snapshot of CG |
| 228 |
snapshot: |
| 229 |
unispherehost: "{{unispherehost}}" |
| 230 |
username: "{{username}}" |
| 231 |
password: "{{password}}" |
| 232 |
validate_certs: "{{validate_certs}}" |
| 233 |
snapshot_name: "{{cg_snapshot_name}}" |
| 234 |
state: "absent" |
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
Return Values |
| 239 |
------------- |
| 240 |
|
| 241 |
changed (always, bool, True) |
| 242 |
Whether or not the resource has changed. |
| 243 |
|
| 244 |
|
| 245 |
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'}) |
| 246 |
Details of the snapshot. |
| 247 |
|
| 248 |
|
| 249 |
is_auto_delete (, str, ) |
| 250 |
Additional information mentioned for snapshot. |
| 251 |
|
| 252 |
|
| 253 |
expiration_time (, str, ) |
| 254 |
Date and time after which the snapshot will expire. |
| 255 |
|
| 256 |
|
| 257 |
hosts_list (, dict, ) |
| 258 |
Contains the name and id of the associated hosts. |
| 259 |
|
| 260 |
|
| 261 |
id (, str, ) |
| 262 |
Unique identifier of the snapshot instance. |
| 263 |
|
| 264 |
|
| 265 |
name (, str, ) |
| 266 |
The name of the snapshot. |
| 267 |
|
| 268 |
|
| 269 |
storage_resource_name (, str, ) |
| 270 |
Name of the storage resource for which the snapshot exists. |
| 271 |
|
| 272 |
|
| 273 |
storage_resource_id (, str, ) |
| 274 |
Id of the storage resource for which the snapshot exists. |
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
Status |
| 282 |
------ |
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
Authors |
| 289 |
~~~~~~~ |
| 290 |
|
| 291 |
- P Srinivas Rao (@srinivas-rao5) <[email protected]> |
| 292 |
|