17
17
short_description: Manage Proxmox zone configurations
18
18
description:
19
19
- list/create/update/delete proxmox sdn zones
20
- author: 'Jana Hoch <[email protected] >'
20
+ author: 'Jana Hoch <[email protected] > (!UNKNOWN)'
21
+ attributes:
22
+ check_mode:
23
+ support: none
24
+ diff_mode:
25
+ support: none
21
26
options:
22
27
state:
23
28
description:
80
85
type: str
81
86
dnszone:
82
87
description:
83
- - dns domain zone ex: mydomain.com
88
+ - dns domain zone.
84
89
type: str
85
90
dp_id:
86
91
description:
167
172
api_password: "{{ vault.proxmox.root_password }}"
168
173
api_host: "{{ pc.proxmox.api_host }}"
169
174
validate_certs: no
170
-
175
+
171
176
- name: Get all simple zones
172
177
community.proxmox.proxmox_zone:
173
178
api_user: "root@pam"
186
191
type: simple
187
192
zone: ansible
188
193
state: present
189
-
194
+
190
195
- name: create a vlan zones
191
196
community.proxmox.proxmox_zone:
192
197
api_user: "root@pam"
197
202
zone: ansible
198
203
state: present
199
204
bridge: vmbr0
200
-
205
+
201
206
- name: update a zones
202
207
community.proxmox.proxmox_zone:
203
208
api_user: "root@pam"
208
213
zone: ansible
209
214
state: update
210
215
mtu: 1200
211
-
216
+
212
217
- name: Delete a zones
213
218
community.proxmox.proxmox_zone:
214
219
api_user: "root@pam"
222
227
223
228
RETURN = r"""
224
229
zones:
225
- description:
226
- - List of zones. if you do not pass zone name.
230
+ description:
231
+ - List of zones. if you do not pass zone name.
227
232
- If you are creating/updating/deleting it'll just return a msg with status
228
233
returned: on success
229
234
type: list
230
235
elements: dict
231
236
sample:
232
- [
237
+ [
233
238
{
234
239
"digest": "e29dea494461aa699ab3bfb7264d95631c8d0e0d",
235
240
"type": "simple",
263
268
"zone": "tsjsfv"
264
269
}
265
270
]
266
-
271
+
267
272
"""
268
273
269
274
from ansible .module_utils .basic import AnsibleModule
272
277
ProxmoxAnsible
273
278
)
274
279
280
+
275
281
def get_proxmox_args ():
276
282
return dict (
277
283
state = dict (type = "str" , choices = ["present" , "absent" , "update" ], required = False ),
@@ -294,7 +300,7 @@ def get_proxmox_args():
294
300
exitnodes_primary = dict (type = "str" , required = False ),
295
301
fabric = dict (type = "str" , required = False ),
296
302
ipam = dict (type = "str" , required = False ),
297
- lock_token = dict (type = "str" , required = False ),
303
+ lock_token = dict (type = "str" , required = False , no_log = False ),
298
304
mac = dict (type = "str" , required = False ),
299
305
mtu = dict (type = "int" , required = False ),
300
306
nodes = dict (type = "str" , required = False ),
@@ -307,6 +313,7 @@ def get_proxmox_args():
307
313
vxlan_port = dict (type = "int" , required = False ),
308
314
)
309
315
316
+
310
317
def get_ansible_module ():
311
318
module_args = proxmox_auth_argument_spec ()
312
319
module_args .update (get_proxmox_args ())
@@ -320,6 +327,7 @@ def get_ansible_module():
320
327
]
321
328
)
322
329
330
+
323
331
class ProxmoxZoneAnsible (ProxmoxAnsible ):
324
332
def __init__ (self , module ):
325
333
super (ProxmoxZoneAnsible , self ).__init__ (module )
@@ -406,7 +414,6 @@ def run(self):
406
414
)
407
415
408
416
def get_zones (self , ** type ):
409
- print ("reached" )
410
417
try :
411
418
return self .proxmox_api .cluster ().sdn ().zones ().get (** type )
412
419
except Exception as e :
@@ -503,7 +510,6 @@ def zone_absent(self, zone_name, lock):
503
510
)
504
511
505
512
506
-
507
513
def main ():
508
514
module = get_ansible_module ()
509
515
proxmox = ProxmoxZoneAnsible (module )
@@ -513,5 +519,6 @@ def main():
513
519
except Exception as e :
514
520
module .fail_json (msg = f'An error occurred: { e } ' )
515
521
522
+
516
523
if __name__ == "__main__" :
517
- main ()
524
+ main ()
0 commit comments