103
103
description:
104
104
- Specifies whether or not the given path is an externally managed
105
105
mountpoint.
106
+ namespace:
107
+ required: false
108
+ description:
109
+ - Specifies the Namespace that should be used on PBS
110
+ share:
111
+ required: false
112
+ description:
113
+ - Specifies the CIFS-Share to use
114
+ subdir:
115
+ required: false
116
+ - specifies the folder in the share dir to use for proxmox
117
+ (useful to seperate proxmox content from other content)
118
+ domain:
119
+ required: false
120
+ - Specifies Realm to use for NTLM/LDAPS Authentification if using
121
+ an AD-Enabled share
106
122
107
123
author:
108
124
- Fabien Brachere (@fbrachere)
170
186
datastore: main
171
187
fingerprint: f2:fb:85:76:d2:2a:c4:96:5c:6e:d8:71:37:36:06:17:09:55:f7:04:e3:74:bb:aa:9e:26:85:92:63:c8:b9:23
172
188
encryption_key: autogen
189
+ namespace: Top/something
173
190
- name: Create a ZFS storage type
174
191
proxmox_storage:
175
192
name: zfs1
176
193
type: zfspool
177
194
content: [ "images", "rootdir" ]
178
195
pool: rpool/data
179
196
sparse: true
197
+ - name: CIFS-Share
198
+ proxmox_storage:
199
+ name: cifs1
200
+ server: cifs-host.domain.tld
201
+ type: cifs
202
+ content: [ "snippets", "vztmpl", "iso" ]
203
+ share: sharename
204
+ subdir: /subdir
205
+ username: user
206
+ password: supersecurepass
207
+ domain: addomain.tld
180
208
'''
181
209
182
210
RETURN = '''
@@ -221,6 +249,13 @@ def __init__(self, module):
221
249
self .sparse = module .params ['sparse' ]
222
250
self .is_mountpoint = module .params ['is_mountpoint' ]
223
251
252
+ # namespace for pbs
253
+ self .namespace = module .params ['namespace' ]
254
+ # CIFS properties
255
+ self .domain = module .params ['domain' ]
256
+ self .subdir = module .params ['subdir' ]
257
+ self .share = module .params ['share' ]
258
+
224
259
# Validate the parameters given to us
225
260
fingerprint_re = re .compile ('^([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}$' )
226
261
if self .fingerprint is not None and not fingerprint_re .match (self .fingerprint ):
@@ -305,11 +340,21 @@ def prepare_storage_args(self):
305
340
args ['vgname' ] = self .vgname
306
341
if self .thinpool is not None :
307
342
args ['thinpool' ] = self .thinpool
343
+ if self .namespace is not None :
344
+ args ['namespace' ] = self .namespace
308
345
if self .sparse is not None :
309
346
args ['sparse' ] = 1 if self .sparse else 0
310
347
if self .is_mountpoint is not None :
311
348
args ['is_mountpoint' ] = 1 if self .is_mountpoint else 0
312
349
350
+ # CIFS
351
+ if self .subdir is not None :
352
+ args ['subdir' ] = self .subdir
353
+ if self .domain is not None :
354
+ args ['domain' ] = self .domain
355
+ if self .share is not None :
356
+ args ['share' ] = self .share
357
+ # end cifs
313
358
if self .maxfiles is not None and 'backup' not in self .content :
314
359
self .module .fail_json (msg = "maxfiles is not allowed when there is no 'backup' in content" )
315
360
if self .krbd is not None and self .type != 'rbd' :
@@ -386,7 +431,7 @@ def main():
386
431
nodes = dict (type = 'list' , required = False , default = None ),
387
432
type = dict (default = None , type = 'str' , required = True ,
388
433
choices = ["dir" , "nfs" , "rbd" , "lvm" , "lvmthin" , "cephfs" ,
389
- "zfspool" , "btrfs" , "pbs" ]),
434
+ "zfspool" , "btrfs" , "pbs" , "cifs" ]),
390
435
# Remaining PVE API arguments (depending on type) past this point
391
436
datastore = dict (default = None , type = 'str' , required = False ),
392
437
encryption_key = dict (default = None , type = 'str' , required = False ),
@@ -406,6 +451,10 @@ def main():
406
451
thinpool = dict (default = None , type = 'str' , required = False ),
407
452
sparse = dict (default = None , type = 'bool' , required = False ),
408
453
is_mountpoint = dict (default = None , type = 'bool' , required = False ),
454
+ namespace = dict (default = None , type = 'str' , required = False ),
455
+ subdir = dict (default = None , type = 'str' , required = False ),
456
+ domain = dict (default = None , type = 'str' , required = False ),
457
+ share = dict (default = None , type = 'str' , required = False ),
409
458
)
410
459
411
460
module = AnsibleModule (
@@ -420,7 +469,8 @@ def main():
420
469
["type" , "lvmthin" , ["vgname" , "thinpool" , "content" ]],
421
470
["type" , "zfspool" , ["pool" , "content" ]],
422
471
["type" , "btrfs" , ["path" , "content" ]],
423
- ["type" , "pbs" , ["server" , "username" , "password" , "datastore" ]]
472
+ ["type" , "pbs" , ["server" , "username" , "password" , "datastore" ]],
473
+ ["type" , "cifs" , ["server" , "share" ]],
424
474
],
425
475
required_by = {
426
476
"master_pubkey" : "encryption_key"
0 commit comments