| 1 |
.. _smbshare_module: |
| 2 |
|
| 3 |
|
| 4 |
smbshare -- Manage SMB shares on Unity storage system |
| 5 |
===================================================== |
| 6 |
|
| 7 |
.. contents:: |
| 8 |
:local: |
| 9 |
:depth: 1 |
| 10 |
|
| 11 |
|
| 12 |
Synopsis |
| 13 |
-------- |
| 14 |
|
| 15 |
Managing SMB Shares on Unity storage system includes create, get, modify, and delete the smb shares. |
| 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 |
share_name (optional, str, None) |
| 34 |
Name of the SMB share. |
| 35 |
|
| 36 |
Required during creation of the SMB share. |
| 37 |
|
| 38 |
For all other operations either *share_name* or *share_id* is required. |
| 39 |
|
| 40 |
|
| 41 |
share_id (optional, str, None) |
| 42 |
ID of the SMB share. |
| 43 |
|
| 44 |
Should not be specified during creation. Id is auto generated. |
| 45 |
|
| 46 |
For all other operations either *share_name* or *share_id* is required. |
| 47 |
|
| 48 |
If *share_id* is used then no need to pass nas_server/filesystem/snapshot/path. |
| 49 |
|
| 50 |
|
| 51 |
path (optional, str, None) |
| 52 |
Local path to the file system/Snapshot or any existing sub-folder of the file system/Snapshot that is shared over the network. |
| 53 |
|
| 54 |
Path is relative to the root of the filesystem. |
| 55 |
|
| 56 |
Required for creation of the SMB share. |
| 57 |
|
| 58 |
|
| 59 |
filesystem_id (optional, str, None) |
| 60 |
The ID of the File System. |
| 61 |
|
| 62 |
Either *filesystem_name* or *filesystem_id* is required for creation of the SMB share for filesystem. |
| 63 |
|
| 64 |
If *filesystem_name* is specified, then *nas_server_name*/*nas_server_id* is required to uniquely identify the filesystem. |
| 65 |
|
| 66 |
Options *filesystem_name* and *filesystem_id* are mutually exclusive parameters. |
| 67 |
|
| 68 |
|
| 69 |
snapshot_id (optional, str, None) |
| 70 |
The ID of the Filesystem Snapshot. |
| 71 |
|
| 72 |
Either *snapshot_name* or *snapshot_id* is required for creation of the SMB share for a snapshot. |
| 73 |
|
| 74 |
If *snapshot_name* is specified, then *nas_server_name*/*nas_server_id* is required to uniquely identify the snapshot. |
| 75 |
|
| 76 |
Options *snapshot_name* and *snapshot_id* are mutually exclusive parameters. |
| 77 |
|
| 78 |
|
| 79 |
nas_server_id (optional, str, None) |
| 80 |
The ID of the NAS Server. |
| 81 |
|
| 82 |
It is not required if *share_id* is used. |
| 83 |
|
| 84 |
|
| 85 |
filesystem_name (optional, str, None) |
| 86 |
The Name of the File System. |
| 87 |
|
| 88 |
Either *filesystem_name* or *filesystem_id* is required for creation of the SMB share for filesystem. |
| 89 |
|
| 90 |
If *filesystem_name* is specified, then *nas_server_name*/*nas_server_id* is required to uniquely identify the filesystem. |
| 91 |
|
| 92 |
Options *filesystem_name* and *filesytem_id* are mutually exclusive parameters. |
| 93 |
|
| 94 |
|
| 95 |
snapshot_name (optional, str, None) |
| 96 |
The Name of the Filesystem Snapshot. |
| 97 |
|
| 98 |
Either *snapshot_name* or *snapshot_id* is required for creation of the SMB share for a snapshot. |
| 99 |
|
| 100 |
If *snapshot_name* is specified, then *nas_server_name*/*nas_server_id* is required to uniquely identify the snapshot. |
| 101 |
|
| 102 |
Options *snapshot_name* and *snapshot_id* are mutually exclusive parameters. |
| 103 |
|
| 104 |
|
| 105 |
nas_server_name (optional, str, None) |
| 106 |
The Name of the NAS Server. |
| 107 |
|
| 108 |
It is not required if *share_id* is used. |
| 109 |
|
| 110 |
Options *nas_server_name* and *nas_server_id* are mutually exclusive parameters. |
| 111 |
|
| 112 |
|
| 113 |
description (optional, str, None) |
| 114 |
Description for the SMB share. |
| 115 |
|
| 116 |
Optional parameter when creating a share. |
| 117 |
|
| 118 |
To modify, pass the new value in description field. |
| 119 |
|
| 120 |
|
| 121 |
is_abe_enabled (optional, bool, None) |
| 122 |
Indicates whether Access-based Enumeration (ABE) for SMB share is enabled. |
| 123 |
|
| 124 |
During creation, if not mentioned then default is ``false``. |
| 125 |
|
| 126 |
|
| 127 |
is_branch_cache_enabled (optional, bool, None) |
| 128 |
Indicates whether Branch Cache optimization for SMB share is enabled. |
| 129 |
|
| 130 |
During creation, if not mentioned then default is ``false``. |
| 131 |
|
| 132 |
|
| 133 |
is_continuous_availability_enabled (optional, bool, None) |
| 134 |
Indicates whether continuous availability for SMB 3.0 is enabled. |
| 135 |
|
| 136 |
During creation, if not mentioned then default is ``false``. |
| 137 |
|
| 138 |
|
| 139 |
is_encryption_enabled (optional, bool, None) |
| 140 |
Indicates whether encryption for SMB 3.0 is enabled at the shared folder level. |
| 141 |
|
| 142 |
During creation, if not mentioned then default is ``false``. |
| 143 |
|
| 144 |
|
| 145 |
offline_availability (optional, str, None) |
| 146 |
Defines valid states of Offline Availability. |
| 147 |
|
| 148 |
``MANUAL``- Only specified files will be available offline. |
| 149 |
|
| 150 |
``DOCUMENTS``- All files that users open will be available offline. |
| 151 |
|
| 152 |
``PROGRAMS``- Program will preferably run from the offline cache even when connected to the network. All files that users open will be available offline. |
| 153 |
|
| 154 |
``NONE``- Prevents clients from storing documents and programs in offline cache. |
| 155 |
|
| 156 |
|
| 157 |
umask (optional, str, None) |
| 158 |
The default UNIX umask for new files created on the SMB Share. |
| 159 |
|
| 160 |
|
| 161 |
state (True, str, None) |
| 162 |
Define whether the SMB share should exist or not. |
| 163 |
|
| 164 |
Value ``present`` indicates that the share should exist on the system. |
| 165 |
|
| 166 |
Value ``absent`` indicates that the share should not exist on the system. |
| 167 |
|
| 168 |
|
| 169 |
unispherehost (True, str, None) |
| 170 |
IP or FQDN of the Unity management server. |
| 171 |
|
| 172 |
|
| 173 |
username (True, str, None) |
| 174 |
The username of the Unity management server. |
| 175 |
|
| 176 |
|
| 177 |
password (True, str, None) |
| 178 |
The password of the Unity management server. |
| 179 |
|
| 180 |
|
| 181 |
validate_certs (optional, bool, True) |
| 182 |
Boolean variable to specify whether or not to validate SSL certificate. |
| 183 |
|
| 184 |
``true`` - Indicates that the SSL certificate should be verified. |
| 185 |
|
| 186 |
``false`` - Indicates that the SSL certificate should not be verified. |
| 187 |
|
| 188 |
|
| 189 |
port (optional, int, 443) |
| 190 |
Port number through which communication happens with Unity management server. |
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
Notes |
| 197 |
----- |
| 198 |
|
| 199 |
.. note:: |
| 200 |
- When ID/Name of the filesystem/snapshot is passed then *nas_server* is not required. If passed, then filesystem/snapshot should exist for the mentioned *nas_server*, else the task will fail. |
| 201 |
- The *check_mode* is not supported. |
| 202 |
- The modules present in this collection named as 'dellemc.unity' are built to support the Dell Unity storage platform. |
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
Examples |
| 208 |
-------- |
| 209 |
|
| 210 |
.. code-block:: yaml+jinja |
| 211 |
|
| 212 |
|
| 213 |
- name: Create SMB share for a filesystem |
| 214 |
smbshare: |
| 215 |
unispherehost: "{{unispherehost}}" |
| 216 |
username: "{{username}}" |
| 217 |
password: "{{password}}" |
| 218 |
validate_certs: "{{validate_certs}}" |
| 219 |
share_name: "sample_smb_share" |
| 220 |
filesystem_name: "sample_fs" |
| 221 |
nas_server_id: "NAS_11" |
| 222 |
path: "/sample_fs" |
| 223 |
description: "Sample SMB share created" |
| 224 |
is_abe_enabled: True |
| 225 |
is_branch_cache_enabled: True |
| 226 |
offline_availability: "DOCUMENTS" |
| 227 |
is_continuous_availability_enabled: True |
| 228 |
is_encryption_enabled: True |
| 229 |
umask: "777" |
| 230 |
state: "present" |
| 231 |
- name: Modify Attributes of SMB share for a filesystem |
| 232 |
smbshare: |
| 233 |
unispherehost: "{{unispherehost}}" |
| 234 |
username: "{{username}}" |
| 235 |
password: "{{password}}" |
| 236 |
validate_certs: "{{validate_certs}}" |
| 237 |
share_name: "sample_smb_share" |
| 238 |
nas_server_name: "sample_nas_server" |
| 239 |
description: "Sample SMB share attributes updated" |
| 240 |
is_abe_enabled: False |
| 241 |
is_branch_cache_enabled: False |
| 242 |
offline_availability: "MANUAL" |
| 243 |
is_continuous_availability_enabled: "False" |
| 244 |
is_encryption_enabled: "False" |
| 245 |
umask: "022" |
| 246 |
state: "present" |
| 247 |
- name: Create SMB share for a snapshot |
| 248 |
smbshare: |
| 249 |
unispherehost: "{{unispherehost}}" |
| 250 |
username: "{{username}}" |
| 251 |
password: "{{password}}" |
| 252 |
validate_certs: "{{validate_certs}}" |
| 253 |
share_name: "sample_snap_smb_share" |
| 254 |
snapshot_name: "sample_snapshot" |
| 255 |
nas_server_id: "NAS_11" |
| 256 |
path: "/sample_snapshot" |
| 257 |
description: "Sample SMB share created for snapshot" |
| 258 |
is_abe_enabled: True |
| 259 |
is_branch_cache_enabled: True |
| 260 |
is_continuous_availability_enabled: True |
| 261 |
is_encryption_enabled: True |
| 262 |
umask: "777" |
| 263 |
state: "present" |
| 264 |
- name: Modify Attributes of SMB share for a snapshot |
| 265 |
smbshare: |
| 266 |
unispherehost: "{{unispherehost}}" |
| 267 |
username: "{{username}}" |
| 268 |
password: "{{password}}" |
| 269 |
validate_certs: "{{validate_certs}}" |
| 270 |
share_name: "sample_snap_smb_share" |
| 271 |
snapshot_name: "sample_snapshot" |
| 272 |
description: "Sample SMB share attributes updated for snapshot" |
| 273 |
is_abe_enabled: False |
| 274 |
is_branch_cache_enabled: False |
| 275 |
offline_availability: "MANUAL" |
| 276 |
is_continuous_availability_enabled: "False" |
| 277 |
is_encryption_enabled: "False" |
| 278 |
umask: "022" |
| 279 |
state: "present" |
| 280 |
- name: Get details of SMB share |
| 281 |
smbshare: |
| 282 |
unispherehost: "{{unispherehost}}" |
| 283 |
username: "{{username}}" |
| 284 |
password: "{{password}}" |
| 285 |
validate_certs: "{{validate_certs}}" |
| 286 |
share_id: "{{smb_share_id}}" |
| 287 |
state: "present" |
| 288 |
- name: Delete SMB share |
| 289 |
smbshare: |
| 290 |
unispherehost: "{{unispherehost}}" |
| 291 |
username: "{{username}}" |
| 292 |
password: "{{password}}" |
| 293 |
validate_certs: "{{validate_certs}}" |
| 294 |
share_id: "{{smb_share_id}}" |
| 295 |
state: "absent" |
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
Return Values |
| 300 |
------------- |
| 301 |
|
| 302 |
changed (always, bool, True) |
| 303 |
Whether or not the resource has changed. |
| 304 |
|
| 305 |
|
| 306 |
smb_share_details (When share exists., dict, {'creation_time': '2022-03-17 11:56:54.867000+00:00', 'description': '', 'existed': True, 'export_paths': ['\\\\multi-prot-pie.extreme1.com\\multi-prot-hui', '\\\\10.230.24.26\\multi-prot-hui'], 'filesystem': {'UnityFileSystem': {'hash': 8748426746492}}, 'filesystem_id': 'fs_140', 'filesystem_name': 'multi-prot-hui', 'hash': 8748426746588, 'id': 'SMBShare_20', 'is_abe_enabled': False, 'is_ace_enabled': False, 'is_branch_cache_enabled': False, 'is_continuous_availability_enabled': False, 'is_dfs_enabled': False, 'is_encryption_enabled': False, 'is_read_only': None, 'modified_time': '2022-03-17 11:56:54.867000+00:00', 'name': 'multi-prot-hui', 'nas_server_id': 'nas_5', 'nas_server_name': 'multi-prot', 'offline_availability': 'CifsShareOfflineAvailabilityEnum.NONE', 'path': '/', 'snap': None, 'type': 'CIFSTypeEnum.CIFS_SHARE', 'umask': '022'}) |
| 307 |
The SMB share details. |
| 308 |
|
| 309 |
|
| 310 |
id (, str, ) |
| 311 |
The ID of the SMB share. |
| 312 |
|
| 313 |
|
| 314 |
name (, str, sample_smb_share) |
| 315 |
Name of the SMB share. |
| 316 |
|
| 317 |
|
| 318 |
filesystem_id (, str, ) |
| 319 |
The ID of the Filesystem. |
| 320 |
|
| 321 |
|
| 322 |
filesystem_name (, str, ) |
| 323 |
The Name of the filesystem |
| 324 |
|
| 325 |
|
| 326 |
snapshot_id (, str, ) |
| 327 |
The ID of the Snapshot. |
| 328 |
|
| 329 |
|
| 330 |
snapshot_name (, str, ) |
| 331 |
The Name of the Snapshot. |
| 332 |
|
| 333 |
|
| 334 |
nas_server_id (, str, ) |
| 335 |
The ID of the nas_server. |
| 336 |
|
| 337 |
|
| 338 |
nas_server_name (, str, ) |
| 339 |
The Name of the nas_server. |
| 340 |
|
| 341 |
|
| 342 |
description (, str, This share is created for demo purpose only.) |
| 343 |
Additional information about the share. |
| 344 |
|
| 345 |
|
| 346 |
is_abe_enabled (, bool, False) |
| 347 |
Whether Access Based enumeration is enforced or not. |
| 348 |
|
| 349 |
|
| 350 |
is_branch_cache_enabled (, bool, False) |
| 351 |
Whether branch cache is enabled or not. |
| 352 |
|
| 353 |
|
| 354 |
is_continuous_availability_enabled (, bool, False) |
| 355 |
Whether the share will be available continuously or not. |
| 356 |
|
| 357 |
|
| 358 |
is_encryption_enabled (, bool, False) |
| 359 |
Whether encryption is enabled or not. |
| 360 |
|
| 361 |
|
| 362 |
umask (, str, ) |
| 363 |
Unix mask for the SMB share. |
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
Status |
| 371 |
------ |
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
Authors |
| 378 |
~~~~~~~ |
| 379 |
|
| 380 |
- P Srinivas Rao (@srinivas-rao5) <[email protected]> |
| 381 |
|