Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_fmupdate_fdssetting.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_fmupdate_fdssetting
15 short_description: Configure FortiGuard settings.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 fmupdate_fdssetting:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 User_Agent:
27 aliases: ['User-Agent']
28 type: str
29 description: Configure the user agent string.
30 fds_clt_ssl_protocol:
31 aliases: ['fds-clt-ssl-protocol']
32 type: str
33 description:
34 - The SSL protocols version for connecting fds server
35 - sslv3 - set SSLv3 as the client version.
36 - tlsv1.
37 - tlsv1.
38 - tlsv1.
39 choices: ['sslv3', 'tlsv1.0', 'tlsv1.1', 'tlsv1.2', 'tlsv1.3']
40 fds_ssl_protocol:
41 aliases: ['fds-ssl-protocol']
42 type: str
43 description:
44 - The SSL protocols version for receiving fgt connection
45 - sslv3 - set SSLv3 as the lowest version.
46 - tlsv1.
47 - tlsv1.
48 - tlsv1.
49 choices: ['sslv3', 'tlsv1.0', 'tlsv1.1', 'tlsv1.2', 'tlsv1.3']
50 fmtr_log:
51 aliases: ['fmtr-log']
52 type: str
53 description:
54 - fmtr log level
55 - emergency - Log level - emergency
56 - alert - Log level - alert
57 - critical - Log level - critical
58 - error - Log level - error
59 - warn - Log level - warn
60 - notice - Log level - notice
61 - info - Log level - info
62 - debug - Log level - debug
63 - disable - Disable linkd log
64 choices: ['emergency', 'alert', 'critical', 'error', 'warn', 'notice', 'info',
65 'debug', 'disable']
66 linkd_log:
67 aliases: ['linkd-log']
68 type: str
69 description:
70 - The linkd log level
71 - emergency - Log level - emergency
72 - alert - Log level - alert
73 - critical - Log level - critical
74 - error - Log level - error
75 - warn - Log level - warn
76 - notice - Log level - notice
77 - info - Log level - info
78 - debug - Log level - debug
79 - disable - Disable linkd log
80 choices: ['emergency', 'alert', 'critical', 'error', 'warn', 'notice', 'info',
81 'debug', 'disable']
82 max_av_ips_version:
83 aliases: ['max-av-ips-version']
84 type: int
85 description: The maximum number of downloadable, full version AV/IPS packages
86 max_work:
87 aliases: ['max-work']
88 type: int
89 description: The maximum number of worker processing download requests
90 push_override:
91 aliases: ['push-override']
92 type: dict
93 description: Push override.
94 suboptions:
95 ip:
96 type: str
97 description: External or virtual IP address of the NAT device that will forward push messages to the FortiManager unit.
98 port:
99 type: int
100 description: Receiving port number on the NAT device
101 status:
102 type: str
103 description:
104 - Enable/disable push updates for clients
105 - disable - Disable setting.
106 - enable - Enable setting.
107 choices: ['disable', 'enable']
108 push_override_to_client:
109 aliases: ['push-override-to-client']
110 type: dict
111 description: Push override to client.
112 suboptions:
113 announce_ip:
114 aliases: ['announce-ip']
115 type: list
116 elements: dict
117 description: Announce ip.
118 suboptions:
119 id:
120 type: int
121 description: ID of the announce IP address
122 ip:
123 type: str
124 description: Announce IPv4 address.
125 port:
126 type: int
127 description: Announce IP port
128 status:
129 type: str
130 description:
131 - Enable/disable push updates
132 - disable - Disable setting.
133 - enable - Enable setting.
134 choices: ['disable', 'enable']
135 send_report:
136 type: str
137 description:
138 - send report/fssi to fds server.
139 - disable - Disable setting.
140 - enable - Enable setting.
141 choices: ['disable', 'enable']
142 send_setup:
143 type: str
144 description:
145 - forward setup to fds server.
146 - disable - Disable setting.
147 - enable - Enable setting.
148 choices: ['disable', 'enable']
149 server_override:
150 aliases: ['server-override']
151 type: dict
152 description: Server override.
153 suboptions:
154 servlist:
155 type: list
156 elements: dict
157 description: Servlist.
158 suboptions:
159 id:
160 type: int
161 description: Override server ID
162 ip:
163 type: str
164 description: IPv4 address of the override server.
165 ip6:
166 type: str
167 description: IPv6 address of the override server.
168 port:
169 type: int
170 description: Port number to use when contacting FortiGuard
171 service_type:
172 aliases: ['service-type']
173 type: raw
174 description:
175 - (list or str)
176 - Override service type.
177 - fds - Server override config for fds
178 - fct - Server override config for fct
179 choices: ['fds', 'fct', 'fai']
180 status:
181 type: str
182 description:
183 - Override status.
184 - disable - Disable setting.
185 - enable - Enable setting.
186 choices: ['disable', 'enable']
187 system_support_fct:
188 aliases: ['system-support-fct']
189 type: list
190 elements: str
191 description:
192 - Supported FortiClient versions.
193 - '4.'
194 - '5.'
195 - '5.'
196 - '5.'
197 - '5.'
198 - '6.'
199 choices: ['4.x', '5.0', '5.2', '5.4', '5.6', '6.0', '6.2', '6.4', '7.0', '7.2',
200 '7.4']
201 system_support_fgt:
202 aliases: ['system-support-fgt']
203 type: list
204 elements: str
205 description:
206 - Supported FortiOS versions.
207 - '5.'
208 - '5.'
209 - '6.'
210 - '6.'
211 choices: ['5.4', '5.6', '6.0', '6.2', '6.4', '7.0', '7.2', '7.4', '7.6']
212 system_support_fml:
213 aliases: ['system-support-fml']
214 type: list
215 elements: str
216 description:
217 - Supported FortiMail versions.
218 - '4.'
219 - '5.'
220 - '6.'
221 choices: ['4.x', '5.x', '6.x', '6.0', '6.2', '6.4', '7.0', '7.2', '7.x']
222 system_support_fsa:
223 aliases: ['system-support-fsa']
224 type: list
225 elements: str
226 description:
227 - Supported FortiSandbox versions.
228 - '1.'
229 - '2.'
230 - '3.'
231 choices: ['1.x', '2.x', '3.x', '4.x', '3.0', '3.1', '3.2', '5.x']
232 system_support_fsw:
233 aliases: ['system-support-fsw']
234 type: list
235 elements: str
236 description:
237 - Supported FortiSwitch versions.
238 - '5.'
239 - '5.'
240 - '6.'
241 - '6.'
242 choices: ['5.4', '5.6', '6.0', '6.2', '4.x', '5.0', '5.2', '6.4']
243 umsvc_log:
244 aliases: ['umsvc-log']
245 type: str
246 description:
247 - The um_service log level
248 - emergency - Log level - emergency
249 - alert - Log level - alert
250 - critical - Log level - critical
251 - error - Log level - error
252 - warn - Log level - warn
253 - notice - Log level - notice
254 - info - Log level - info
255 - debug - Log level - debug
256 - disable - Disable linkd log
257 choices: ['emergency', 'alert', 'critical', 'error', 'warn', 'notice', 'info',
258 'debug', 'disable']
259 unreg_dev_option:
260 aliases: ['unreg-dev-option']
261 type: str
262 description:
263 - set the option for unregister devices
264 - ignore - Ignore all unregistered devices.
265 - svc-only - Allow update requests without adding the device.
266 - add-service - Add unregistered devices and allow update request.
267 choices: ['ignore', 'svc-only', 'add-service']
268 update_schedule:
269 aliases: ['update-schedule']
270 type: dict
271 description: Update schedule.
272 suboptions:
273 day:
274 type: str
275 description:
276 - Configure the day the update will occur, if the freqnecy is weekly
277 - Sunday - Update every Sunday.
278 - Monday - Update every Monday.
279 - Tuesday - Update every Tuesday.
280 - Wednesday - Update every Wednesday.
281 - Thursday - Update every Thursday.
282 - Friday - Update every Friday.
283 - Saturday - Update every Saturday.
284 choices: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',
285 'Friday', 'Saturday']
286 frequency:
287 type: str
288 description:
289 - Configure update frequency
290 - every - Time interval.
291 - daily - Every day.
292 - weekly - Every week.
293 choices: ['every', 'daily', 'weekly']
294 status:
295 type: str
296 description:
297 - Enable/disable scheduled updates.
298 - disable - Disable setting.
299 - enable - Enable setting.
300 choices: ['disable', 'enable']
301 time:
302 type: raw
303 description: (list) Time interval between updates, or the hour and minute when the update occurs
304 wanip_query_mode:
305 aliases: ['wanip-query-mode']
306 type: str
307 description:
308 - public ip query mode
309 - disable - Do not query public ip
310 - ipify - Get public IP through https
311 choices: ['disable', 'ipify']
312 fortiguard_anycast:
313 aliases: ['fortiguard-anycast']
314 type: str
315 description:
316 - Enable/disable use of FortiGuards anycast network
317 - disable - Disable setting.
318 - enable - Enable setting.
319 choices: ['disable', 'enable']
320 fortiguard_anycast_source:
321 aliases: ['fortiguard-anycast-source']
322 type: str
323 description:
324 - Configure which of Fortinets servers to provide FortiGuard services in FortiGuards anycast network.
325 - fortinet - Use Fortinets servers to provide FortiGuard services in FortiGuards anycast network.
326 - aws - Use Fortinets AWS servers to provide FortiGuard services in FortiGuards anycast network.
327 choices: ['fortinet', 'aws']
328 system_support_fdc:
329 aliases: ['system-support-fdc']
330 type: list
331 elements: str
332 description:
333 - Supported FortiDeceptor versions.
334 - '3.'
335 - '4.'
336 choices: ['3.x', '4.x', '5.x', '6.x']
337 system_support_fts:
338 aliases: ['system-support-fts']
339 type: list
340 elements: str
341 description:
342 - Supported FortiTester versions.
343 - '3.'
344 - '4.'
345 - '7.'
346 choices: ['3.x', '4.x', '7.x']
347 system_support_faz:
348 aliases: ['system-support-faz']
349 type: list
350 elements: str
351 description:
352 - Supported FortiAnalyzer versions.
353 - '6.'
354 - '7.'
355 choices: ['6.x', '7.x']
356 system_support_fis:
357 aliases: ['system-support-fis']
358 type: list
359 elements: str
360 description:
361 - Supported FortiIsolator versions.
362 - '1.'
363 - '2.'
364 choices: ['1.x', '2.x']
365 system_support_fai:
366 aliases: ['system-support-fai']
367 type: list
368 elements: str
369 description:
370 - Supported FortiNDR versions.
371 - '7.'
372 choices: ['7.x']
373 '''
374
375 EXAMPLES = '''
376 - name: Example playbook (generated based on argument schema)
377 hosts: fortimanagers
378 connection: httpapi
379 gather_facts: false
380 tasks:
381 - name: Configure FortiGuard settings.
382 fortinet.fortimanager.fmgr_fmupdate_fdssetting:
383 # workspace_locking_adom: <global or your adom name>
384 fmupdate_fdssetting:
385 # User_Agent: <string>
386 # fds_clt_ssl_protocol: <value in [sslv3, tlsv1.0, tlsv1.1, ...]>
387 # fds_ssl_protocol: <value in [sslv3, tlsv1.0, tlsv1.1, ...]>
388 # fmtr_log: <value in [emergency, alert, critical, ...]>
389 # linkd_log: <value in [emergency, alert, critical, ...]>
390 # max_av_ips_version: <integer>
391 # max_work: <integer>
392 # push_override:
393 # ip: <string>
394 # port: <integer>
395 # status: <value in [disable, enable]>
396 # push_override_to_client:
397 # announce_ip:
398 # - id: <integer>
399 # ip: <string>
400 # port: <integer>
401 # status: <value in [disable, enable]>
402 # send_report: <value in [disable, enable]>
403 # send_setup: <value in [disable, enable]>
404 # server_override:
405 # servlist:
406 # - id: <integer>
407 # ip: <string>
408 # ip6: <string>
409 # port: <integer>
410 # service_type: ["fds", "fct", "fai"]
411 # status: <value in [disable, enable]>
412 # system_support_fct: ["4.x", "5.0", "5.2", "5.4", "5.6", "6.0", "6.2", "6.4", "7.0",
413 # "7.2", "7.4"]
414 # system_support_fgt: ["5.4", "5.6", "6.0", "6.2", "6.4", "7.0", "7.2", "7.4", "7.6"]
415 # system_support_fml: ["4.x", "5.x", "6.x", "6.0", "6.2", "6.4", "7.0", "7.2", "7.x"]
416 # system_support_fsa: ["1.x", "2.x", "3.x", "4.x", "3.0", "3.1", "3.2", "5.x"]
417 # system_support_fsw: ["5.4", "5.6", "6.0", "6.2", "4.x", "5.0", "5.2", "6.4"]
418 # umsvc_log: <value in [emergency, alert, critical, ...]>
419 # unreg_dev_option: <value in [ignore, svc-only, add-service]>
420 # update_schedule:
421 # day: <value in [Sunday, Monday, Tuesday, ...]>
422 # frequency: <value in [every, daily, weekly]>
423 # status: <value in [disable, enable]>
424 # time: <list or string>
425 # wanip_query_mode: <value in [disable, ipify]>
426 # fortiguard_anycast: <value in [disable, enable]>
427 # fortiguard_anycast_source: <value in [fortinet, aws]>
428 # system_support_fdc: ["3.x", "4.x", "5.x", "6.x"]
429 # system_support_fts: ["3.x", "4.x", "7.x"]
430 # system_support_faz: ["6.x", "7.x"]
431 # system_support_fis: ["1.x", "2.x"]
432 # system_support_fai: ["7.x"]
433 '''
434
435 RETURN = '''
436 meta:
437 description: The result of the request.
438 type: dict
439 returned: always
440 contains:
441 request_url:
442 description: The full url requested.
443 returned: always
444 type: str
445 sample: /sys/login/user
446 response_code:
447 description: The status of api request.
448 returned: always
449 type: int
450 sample: 0
451 response_data:
452 description: The api response.
453 type: list
454 returned: always
455 response_message:
456 description: The descriptive message of the api response.
457 type: str
458 returned: always
459 sample: OK.
460 system_information:
461 description: The information of the target system.
462 type: dict
463 returned: always
464 rc:
465 description: The status the request.
466 type: int
467 returned: always
468 sample: 0
469 version_check_warning:
470 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
471 type: list
472 returned: complex
473 '''
474 from ansible.module_utils.basic import AnsibleModule
475 from ansible.module_utils.connection import Connection
476 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
477 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
478
479
480 def main():
481 urls_list = [
482 '/cli/global/fmupdate/fds-setting'
483 ]
484 module_arg_spec = {
485 'fmupdate_fdssetting': {
486 'type': 'dict', 'v_range': [['6.0.0', '']],
487 'options': {
488 'User-Agent': {'type': 'str'},
489 'fds-clt-ssl-protocol': {'choices': ['sslv3', 'tlsv1.0', 'tlsv1.1', 'tlsv1.2', 'tlsv1.3'], 'type': 'str'},
490 'fds-ssl-protocol': {'choices': ['sslv3', 'tlsv1.0', 'tlsv1.1', 'tlsv1.2', 'tlsv1.3'], 'type': 'str'},
491 'fmtr-log': {'choices': ['emergency', 'alert', 'critical', 'error', 'warn', 'notice', 'info', 'debug', 'disable'], 'type': 'str'},
492 'linkd-log': {'choices': ['emergency', 'alert', 'critical', 'error', 'warn', 'notice', 'info', 'debug', 'disable'], 'type': 'str'},
493 'max-av-ips-version': {'type': 'int'},
494 'max-work': {'type': 'int'},
495 'push-override': {
496 'type': 'dict',
497 'options': {'ip': {'type': 'str'}, 'port': {'type': 'int'}, 'status': {'choices': ['disable', 'enable'], 'type': 'str'}}
498 },
499 'push-override-to-client': {
500 'type': 'dict',
501 'options': {
502 'announce-ip': {
503 'type': 'list',
504 'options': {'id': {'type': 'int'}, 'ip': {'type': 'str'}, 'port': {'type': 'int'}},
505 'elements': 'dict'
506 },
507 'status': {'choices': ['disable', 'enable'], 'type': 'str'}
508 }
509 },
510 'send_report': {'choices': ['disable', 'enable'], 'type': 'str'},
511 'send_setup': {'choices': ['disable', 'enable'], 'type': 'str'},
512 'server-override': {
513 'type': 'dict',
514 'options': {
515 'servlist': {
516 'type': 'list',
517 'options': {
518 'id': {'type': 'int'},
519 'ip': {'type': 'str'},
520 'ip6': {'type': 'str'},
521 'port': {'type': 'int'},
522 'service-type': {'type': 'raw', 'choices': ['fds', 'fct', 'fai']}
523 },
524 'elements': 'dict'
525 },
526 'status': {'choices': ['disable', 'enable'], 'type': 'str'}
527 }
528 },
529 'system-support-fct': {
530 'type': 'list',
531 'choices': ['4.x', '5.0', '5.2', '5.4', '5.6', '6.0', '6.2', '6.4', '7.0', '7.2', '7.4'],
532 'elements': 'str'
533 },
534 'system-support-fgt': {'type': 'list', 'choices': ['5.4', '5.6', '6.0', '6.2', '6.4', '7.0', '7.2', '7.4', '7.6'], 'elements': 'str'},
535 'system-support-fml': {'type': 'list', 'choices': ['4.x', '5.x', '6.x', '6.0', '6.2', '6.4', '7.0', '7.2', '7.x'], 'elements': 'str'},
536 'system-support-fsa': {'type': 'list', 'choices': ['1.x', '2.x', '3.x', '4.x', '3.0', '3.1', '3.2', '5.x'], 'elements': 'str'},
537 'system-support-fsw': {
538 'v_range': [['6.0.0', '6.4.5'], ['7.0.0', '7.0.0']],
539 'type': 'list',
540 'choices': ['5.4', '5.6', '6.0', '6.2', '4.x', '5.0', '5.2', '6.4'],
541 'elements': 'str'
542 },
543 'umsvc-log': {'choices': ['emergency', 'alert', 'critical', 'error', 'warn', 'notice', 'info', 'debug', 'disable'], 'type': 'str'},
544 'unreg-dev-option': {'choices': ['ignore', 'svc-only', 'add-service'], 'type': 'str'},
545 'update-schedule': {
546 'type': 'dict',
547 'options': {
548 'day': {'choices': ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], 'type': 'str'},
549 'frequency': {'choices': ['every', 'daily', 'weekly'], 'type': 'str'},
550 'status': {'choices': ['disable', 'enable'], 'type': 'str'},
551 'time': {'type': 'raw'}
552 }
553 },
554 'wanip-query-mode': {'choices': ['disable', 'ipify'], 'type': 'str'},
555 'fortiguard-anycast': {'v_range': [['6.4.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
556 'fortiguard-anycast-source': {'v_range': [['6.4.0', '']], 'choices': ['fortinet', 'aws'], 'type': 'str'},
557 'system-support-fdc': {
558 'v_range': [['6.4.6', '6.4.15'], ['7.0.1', '']],
559 'type': 'list',
560 'choices': ['3.x', '4.x', '5.x', '6.x'],
561 'elements': 'str'
562 },
563 'system-support-fts': {
564 'v_range': [['6.4.6', '6.4.15'], ['7.0.1', '']],
565 'type': 'list',
566 'choices': ['3.x', '4.x', '7.x'],
567 'elements': 'str'
568 },
569 'system-support-faz': {'v_range': [['7.0.7', '7.0.16'], ['7.2.2', '']], 'type': 'list', 'choices': ['6.x', '7.x'], 'elements': 'str'},
570 'system-support-fis': {'v_range': [['7.4.0', '']], 'type': 'list', 'choices': ['1.x', '2.x'], 'elements': 'str'},
571 'system-support-fai': {'v_range': [['7.6.0', '']], 'type': 'list', 'choices': ['7.x'], 'elements': 'str'}
572 }
573 }
574 }
575
576 module_option_spec = get_module_arg_spec('partial crud')
577 module_arg_spec.update(module_option_spec)
578 check_galaxy_version(module_arg_spec)
579 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'fmupdate_fdssetting'),
580 supports_check_mode=True)
581 if not module._socket_path:
582 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
583 connection = Connection(module._socket_path)
584 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
585 None, 'data', module, connection)
586 fmgr.process_partial_crud()
587 module.exit_json(meta=module.params)
588
589
590 if __name__ == '__main__':
591 main()