Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_vpnmgr_vpntable.py

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3 # Copyright 2019-2024 Fortinet, Inc.
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 __metaclass__ = type
7
8 ANSIBLE_METADATA = {'status': ['preview'],
9 'supported_by': 'community',
10 'metadata_version': '1.1'}
11
12 DOCUMENTATION = '''
13 ---
14 module: fmgr_vpnmgr_vpntable
15 short_description: Vpnmgr vpntable
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 vpnmgr_vpntable:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 authmethod:
34 type: str
35 description: Authmethod.
36 choices: ['psk', 'rsa-signature', 'signature']
37 auto_zone_policy:
38 aliases: ['auto-zone-policy']
39 type: str
40 description: Auto zone policy.
41 choices: ['disable', 'enable']
42 certificate:
43 type: raw
44 description: (list or str) Certificate.
45 description:
46 type: str
47 description: Description.
48 dpd:
49 type: str
50 description: Dpd.
51 choices: ['disable', 'enable', 'on-idle', 'on-demand']
52 dpd_retrycount:
53 aliases: ['dpd-retrycount']
54 type: int
55 description: Dpd retrycount.
56 dpd_retryinterval:
57 aliases: ['dpd-retryinterval']
58 type: raw
59 description: (list) Dpd retryinterval.
60 fcc_enforcement:
61 aliases: ['fcc-enforcement']
62 type: str
63 description: Fcc enforcement.
64 choices: ['disable', 'enable']
65 hub2spoke_zone:
66 aliases: ['hub2spoke-zone']
67 type: raw
68 description: (list or str) Hub2spoke zone.
69 ike_version:
70 aliases: ['ike-version']
71 type: str
72 description: Ike version.
73 choices: ['1', '2']
74 ike1dhgroup:
75 type: list
76 elements: str
77 description: Ike1dhgroup.
78 choices: ['1', '2', '5', '14', '15', '16', '17', '18', '19', '20', '21', '27',
79 '28', '29', '30', '31', '32']
80 ike1dpd:
81 type: str
82 description: Ike1dpd.
83 choices: ['disable', 'enable']
84 ike1keylifesec:
85 type: int
86 description: Ike1keylifesec.
87 ike1localid:
88 type: str
89 description: Ike1localid.
90 ike1mode:
91 type: str
92 description: Ike1mode.
93 choices: ['main', 'aggressive']
94 ike1natkeepalive:
95 type: int
96 description: Ike1natkeepalive.
97 ike1nattraversal:
98 type: str
99 description: Ike1nattraversal.
100 choices: ['disable', 'enable', 'forced']
101 ike1proposal:
102 type: str
103 description: Ike1proposal.
104 choices: ['des-md5', 'des-sha1', '3des-md5', '3des-sha1', 'aes128-md5',
105 'aes128-sha1', 'aes192-md5', 'aes192-sha1', 'aes256-md5', 'aes256-sha1',
106 'des-sha256', '3des-sha256', 'aes128-sha256', 'aes192-sha256',
107 'aes256-sha256', 'des-sha384', 'des-sha512', '3des-sha384',
108 '3des-sha512', 'aes128-sha384', 'aes128-sha512', 'aes192-sha384',
109 'aes192-sha512', 'aes256-sha384', 'aes256-sha512', 'aria128-md5',
110 'aria128-sha1', 'aria128-sha256', 'aria128-sha384', 'aria128-sha512',
111 'aria192-md5', 'aria192-sha1', 'aria192-sha256', 'aria192-sha384',
112 'aria192-sha512', 'aria256-md5', 'aria256-sha1', 'aria256-sha256',
113 'aria256-sha384', 'aria256-sha512', 'seed-md5', 'seed-sha1',
114 'seed-sha256', 'seed-sha384', 'seed-sha512', 'aes128gcm-prfsha1',
115 'aes128gcm-prfsha256', 'aes128gcm-prfsha384', 'aes128gcm-prfsha512',
116 'aes256gcm-prfsha1', 'aes256gcm-prfsha256', 'aes256gcm-prfsha384',
117 'aes256gcm-prfsha512', 'chacha20poly1305-prfsha1',
118 'chacha20poly1305-prfsha256', 'chacha20poly1305-prfsha384',
119 'chacha20poly1305-prfsha512']
120 ike2autonego:
121 type: str
122 description: Ike2autonego.
123 choices: ['disable', 'enable']
124 ike2dhgroup:
125 type: list
126 elements: str
127 description: Ike2dhgroup.
128 choices: ['1', '2', '5', '14', '15', '16', '17', '18', '19', '20', '21', '27',
129 '28', '29', '30', '31', '32']
130 ike2keepalive:
131 type: str
132 description: Ike2keepalive.
133 choices: ['disable', 'enable']
134 ike2keylifekbs:
135 type: int
136 description: Ike2keylifekbs.
137 ike2keylifesec:
138 type: int
139 description: Ike2keylifesec.
140 ike2keylifetype:
141 type: str
142 description: Ike2keylifetype.
143 choices: ['seconds', 'kbs', 'both']
144 ike2proposal:
145 type: str
146 description: Ike2proposal.
147 choices: ['null-md5', 'null-sha1', 'des-null', '3des-null', 'des-md5', 'des-sha1',
148 '3des-md5', '3des-sha1', 'aes128-md5', 'aes128-sha1', 'aes192-md5',
149 'aes192-sha1', 'aes256-md5', 'aes256-sha1', 'aes128-null',
150 'aes192-null', 'aes256-null', 'null-sha256', 'des-sha256',
151 '3des-sha256', 'aes128-sha256', 'aes192-sha256', 'aes256-sha256',
152 'des-sha384', 'des-sha512', '3des-sha384', '3des-sha512',
153 'aes128-sha384', 'aes128-sha512', 'aes192-sha384', 'aes192-sha512',
154 'aes256-sha384', 'aes256-sha512', 'null-sha384', 'null-sha512',
155 'aria128-null', 'aria128-md5', 'aria128-sha1', 'aria128-sha256',
156 'aria128-sha384', 'aria128-sha512', 'aria192-null', 'aria192-md5',
157 'aria192-sha1', 'aria192-sha256', 'aria192-sha384', 'aria192-sha512',
158 'aria256-null', 'aria256-md5', 'aria256-sha1', 'aria256-sha256',
159 'aria256-sha384', 'aria256-sha512', 'seed-null', 'seed-md5',
160 'seed-sha1', 'seed-sha256', 'seed-sha384', 'seed-sha512', 'aes128gcm',
161 'aes256gcm', 'chacha20poly1305']
162 inter_vdom:
163 aliases: ['inter-vdom']
164 type: str
165 description: Inter vdom.
166 choices: ['disable', 'enable']
167 intf_mode:
168 aliases: ['intf-mode']
169 type: str
170 description: Intf mode.
171 choices: ['off', 'on']
172 localid_type:
173 aliases: ['localid-type']
174 type: str
175 description: Localid type.
176 choices: ['auto', 'fqdn', 'user-fqdn', 'keyid', 'address', 'asn1dn']
177 name:
178 type: str
179 description: Name.
180 required: true
181 negotiate_timeout:
182 aliases: ['negotiate-timeout']
183 type: int
184 description: Negotiate timeout.
185 npu_offload:
186 aliases: ['npu-offload']
187 type: str
188 description: Npu offload.
189 choices: ['disable', 'enable']
190 pfs:
191 type: str
192 description: Pfs.
193 choices: ['disable', 'enable']
194 psk_auto_generate:
195 aliases: ['psk-auto-generate']
196 type: str
197 description: Psk auto generate.
198 choices: ['disable', 'enable']
199 psksecret:
200 type: raw
201 description: (list) Psksecret.
202 replay:
203 type: str
204 description: Replay.
205 choices: ['disable', 'enable']
206 rsa_certificate:
207 aliases: ['rsa-certificate']
208 type: str
209 description: Rsa certificate.
210 spoke2hub_zone:
211 aliases: ['spoke2hub-zone']
212 type: raw
213 description: (list or str) Spoke2hub zone.
214 topology:
215 type: str
216 description: Topology.
217 choices: ['meshed', 'star', 'dialup']
218 vpn_zone:
219 aliases: ['vpn-zone']
220 type: raw
221 description: (list or str) Vpn zone.
222 network_id:
223 aliases: ['network-id']
224 type: int
225 description: Network id.
226 network_overlay:
227 aliases: ['network-overlay']
228 type: str
229 description: Network overlay.
230 choices: ['disable', 'enable']
231 '''
232
233 EXAMPLES = '''
234 - name: Example playbook (generated based on argument schema)
235 hosts: fortimanagers
236 connection: httpapi
237 gather_facts: false
238 tasks:
239 - name: Vpnmgr vpntable
240 fortinet.fortimanager.fmgr_vpnmgr_vpntable:
241 # workspace_locking_adom: <global or your adom name>
242 adom: <your own value>
243 state: present # <value in [present, absent]>
244 vpnmgr_vpntable:
245 name: "your value" # Required variable, string
246 # authmethod: <value in [psk, rsa-signature, signature]>
247 # auto_zone_policy: <value in [disable, enable]>
248 # certificate: <list or string>
249 # description: <string>
250 # dpd: <value in [disable, enable, on-idle, ...]>
251 # dpd_retrycount: <integer>
252 # dpd_retryinterval: <list or integer>
253 # fcc_enforcement: <value in [disable, enable]>
254 # hub2spoke_zone: <list or string>
255 # ike_version: <value in [1, 2]>
256 # ike1dhgroup: ["1", "2", "5", "14", "15", "16", "17", "18", "19", "20", "21", "27",
257 # "28", "29", "30", "31", "32"]
258 # ike1dpd: <value in [disable, enable]>
259 # ike1keylifesec: <integer>
260 # ike1localid: <string>
261 # ike1mode: <value in [main, aggressive]>
262 # ike1natkeepalive: <integer>
263 # ike1nattraversal: <value in [disable, enable, forced]>
264 # ike1proposal: <value in [des-md5, des-sha1, 3des-md5, ...]>
265 # ike2autonego: <value in [disable, enable]>
266 # ike2dhgroup: ["1", "2", "5", "14", "15", "16", "17", "18", "19", "20", "21", "27",
267 # "28", "29", "30", "31", "32"]
268 # ike2keepalive: <value in [disable, enable]>
269 # ike2keylifekbs: <integer>
270 # ike2keylifesec: <integer>
271 # ike2keylifetype: <value in [seconds, kbs, both]>
272 # ike2proposal: <value in [null-md5, null-sha1, des-null, ...]>
273 # inter_vdom: <value in [disable, enable]>
274 # intf_mode: <value in [off, on]>
275 # localid_type: <value in [auto, fqdn, user-fqdn, ...]>
276 # negotiate_timeout: <integer>
277 # npu_offload: <value in [disable, enable]>
278 # pfs: <value in [disable, enable]>
279 # psk_auto_generate: <value in [disable, enable]>
280 # psksecret: <list or string>
281 # replay: <value in [disable, enable]>
282 # rsa_certificate: <string>
283 # spoke2hub_zone: <list or string>
284 # topology: <value in [meshed, star, dialup]>
285 # vpn_zone: <list or string>
286 # network_id: <integer>
287 # network_overlay: <value in [disable, enable]>
288 '''
289
290 RETURN = '''
291 meta:
292 description: The result of the request.
293 type: dict
294 returned: always
295 contains:
296 request_url:
297 description: The full url requested.
298 returned: always
299 type: str
300 sample: /sys/login/user
301 response_code:
302 description: The status of api request.
303 returned: always
304 type: int
305 sample: 0
306 response_data:
307 description: The api response.
308 type: list
309 returned: always
310 response_message:
311 description: The descriptive message of the api response.
312 type: str
313 returned: always
314 sample: OK.
315 system_information:
316 description: The information of the target system.
317 type: dict
318 returned: always
319 rc:
320 description: The status the request.
321 type: int
322 returned: always
323 sample: 0
324 version_check_warning:
325 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
326 type: list
327 returned: complex
328 '''
329 from ansible.module_utils.basic import AnsibleModule
330 from ansible.module_utils.connection import Connection
331 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
332 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
333
334
335 def main():
336 urls_list = [
337 '/pm/config/adom/{adom}/obj/vpnmgr/vpntable',
338 '/pm/config/global/obj/vpnmgr/vpntable'
339 ]
340 module_arg_spec = {
341 'adom': {'required': True, 'type': 'str'},
342 'revision_note': {'type': 'str'},
343 'vpnmgr_vpntable': {
344 'type': 'dict', 'v_range': [['6.0.0', '']],
345 'options': {
346 'authmethod': {'choices': ['psk', 'rsa-signature', 'signature'], 'type': 'str'},
347 'auto-zone-policy': {'choices': ['disable', 'enable'], 'type': 'str'},
348 'certificate': {'type': 'raw'},
349 'description': {'type': 'str'},
350 'dpd': {'choices': ['disable', 'enable', 'on-idle', 'on-demand'], 'type': 'str'},
351 'dpd-retrycount': {'type': 'int'},
352 'dpd-retryinterval': {'type': 'raw'},
353 'fcc-enforcement': {'choices': ['disable', 'enable'], 'type': 'str'},
354 'hub2spoke-zone': {'type': 'raw'},
355 'ike-version': {'choices': ['1', '2'], 'type': 'str'},
356 'ike1dhgroup': {
357 'type': 'list',
358 'choices': ['1', '2', '5', '14', '15', '16', '17', '18', '19', '20', '21', '27', '28', '29', '30', '31', '32'],
359 'elements': 'str'
360 },
361 'ike1dpd': {'choices': ['disable', 'enable'], 'type': 'str'},
362 'ike1keylifesec': {'no_log': True, 'type': 'int'},
363 'ike1localid': {'v_range': [['6.0.0', '7.4.6'], ['7.6.0', '7.6.3']], 'type': 'str'},
364 'ike1mode': {'choices': ['main', 'aggressive'], 'type': 'str'},
365 'ike1natkeepalive': {'type': 'int'},
366 'ike1nattraversal': {'choices': ['disable', 'enable', 'forced'], 'type': 'str'},
367 'ike1proposal': {
368 'choices': [
369 'des-md5', 'des-sha1', '3des-md5', '3des-sha1', 'aes128-md5', 'aes128-sha1', 'aes192-md5', 'aes192-sha1', 'aes256-md5',
370 'aes256-sha1', 'des-sha256', '3des-sha256', 'aes128-sha256', 'aes192-sha256', 'aes256-sha256', 'des-sha384', 'des-sha512',
371 '3des-sha384', '3des-sha512', 'aes128-sha384', 'aes128-sha512', 'aes192-sha384', 'aes192-sha512', 'aes256-sha384',
372 'aes256-sha512', 'aria128-md5', 'aria128-sha1', 'aria128-sha256', 'aria128-sha384', 'aria128-sha512', 'aria192-md5',
373 'aria192-sha1', 'aria192-sha256', 'aria192-sha384', 'aria192-sha512', 'aria256-md5', 'aria256-sha1', 'aria256-sha256',
374 'aria256-sha384', 'aria256-sha512', 'seed-md5', 'seed-sha1', 'seed-sha256', 'seed-sha384', 'seed-sha512', 'aes128gcm-prfsha1',
375 'aes128gcm-prfsha256', 'aes128gcm-prfsha384', 'aes128gcm-prfsha512', 'aes256gcm-prfsha1', 'aes256gcm-prfsha256',
376 'aes256gcm-prfsha384', 'aes256gcm-prfsha512', 'chacha20poly1305-prfsha1', 'chacha20poly1305-prfsha256',
377 'chacha20poly1305-prfsha384', 'chacha20poly1305-prfsha512'
378 ],
379 'type': 'str'
380 },
381 'ike2autonego': {'choices': ['disable', 'enable'], 'type': 'str'},
382 'ike2dhgroup': {
383 'type': 'list',
384 'choices': ['1', '2', '5', '14', '15', '16', '17', '18', '19', '20', '21', '27', '28', '29', '30', '31', '32'],
385 'elements': 'str'
386 },
387 'ike2keepalive': {'choices': ['disable', 'enable'], 'type': 'str'},
388 'ike2keylifekbs': {'no_log': True, 'type': 'int'},
389 'ike2keylifesec': {'no_log': True, 'type': 'int'},
390 'ike2keylifetype': {'choices': ['seconds', 'kbs', 'both'], 'type': 'str'},
391 'ike2proposal': {
392 'choices': [
393 'null-md5', 'null-sha1', 'des-null', '3des-null', 'des-md5', 'des-sha1', '3des-md5', '3des-sha1', 'aes128-md5', 'aes128-sha1',
394 'aes192-md5', 'aes192-sha1', 'aes256-md5', 'aes256-sha1', 'aes128-null', 'aes192-null', 'aes256-null', 'null-sha256',
395 'des-sha256', '3des-sha256', 'aes128-sha256', 'aes192-sha256', 'aes256-sha256', 'des-sha384', 'des-sha512', '3des-sha384',
396 '3des-sha512', 'aes128-sha384', 'aes128-sha512', 'aes192-sha384', 'aes192-sha512', 'aes256-sha384', 'aes256-sha512',
397 'null-sha384', 'null-sha512', 'aria128-null', 'aria128-md5', 'aria128-sha1', 'aria128-sha256', 'aria128-sha384',
398 'aria128-sha512', 'aria192-null', 'aria192-md5', 'aria192-sha1', 'aria192-sha256', 'aria192-sha384', 'aria192-sha512',
399 'aria256-null', 'aria256-md5', 'aria256-sha1', 'aria256-sha256', 'aria256-sha384', 'aria256-sha512', 'seed-null', 'seed-md5',
400 'seed-sha1', 'seed-sha256', 'seed-sha384', 'seed-sha512', 'aes128gcm', 'aes256gcm', 'chacha20poly1305'
401 ],
402 'type': 'str'
403 },
404 'inter-vdom': {'choices': ['disable', 'enable'], 'type': 'str'},
405 'intf-mode': {'choices': ['off', 'on'], 'type': 'str'},
406 'localid-type': {'choices': ['auto', 'fqdn', 'user-fqdn', 'keyid', 'address', 'asn1dn'], 'type': 'str'},
407 'name': {'required': True, 'type': 'str'},
408 'negotiate-timeout': {'type': 'int'},
409 'npu-offload': {'choices': ['disable', 'enable'], 'type': 'str'},
410 'pfs': {'choices': ['disable', 'enable'], 'type': 'str'},
411 'psk-auto-generate': {'choices': ['disable', 'enable'], 'type': 'str'},
412 'psksecret': {'no_log': True, 'type': 'raw'},
413 'replay': {'choices': ['disable', 'enable'], 'type': 'str'},
414 'rsa-certificate': {'type': 'str'},
415 'spoke2hub-zone': {'type': 'raw'},
416 'topology': {'choices': ['meshed', 'star', 'dialup'], 'type': 'str'},
417 'vpn-zone': {'type': 'raw'},
418 'network-id': {'v_range': [['6.2.5', '']], 'type': 'int'},
419 'network-overlay': {'v_range': [['6.2.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
420 }
421 }
422 }
423
424 module_option_spec = get_module_arg_spec('full crud')
425 module_arg_spec.update(module_option_spec)
426 check_galaxy_version(module_arg_spec)
427 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'vpnmgr_vpntable'),
428 supports_check_mode=True)
429 if not module._socket_path:
430 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
431 connection = Connection(module._socket_path)
432 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
433 'name', 'data', module, connection)
434 fmgr.process_crud()
435 module.exit_json(meta=module.params)
436
437
438 if __name__ == '__main__':
439 main()