Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_admin_setting.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_system_admin_setting
15 short_description: Admin setting.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 system_admin_setting:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 access_banner:
27 aliases: ['access-banner']
28 type: str
29 description:
30 - Enable/disable access banner.
31 - disable - Disable setting.
32 - enable - Enable setting.
33 choices: ['disable', 'enable']
34 admin_https_redirect:
35 aliases: ['admin-https-redirect']
36 type: str
37 description:
38 - Enable/disable redirection of HTTP admin traffic to HTTPS.
39 - disable - Disable setting.
40 - enable - Enable setting.
41 choices: ['disable', 'enable']
42 admin_login_max:
43 aliases: ['admin-login-max']
44 type: int
45 description: Maximum number admin users logged in at one time
46 admin_server_cert:
47 type: str
48 description: HTTPS & Web Service server certificate.
49 allow_register:
50 type: str
51 description:
52 - Enable/disable allowance of register an unregistered device.
53 - disable - Disable setting.
54 - enable - Enable setting.
55 choices: ['disable', 'enable']
56 auto_update:
57 aliases: ['auto-update']
58 type: str
59 description:
60 - Enable/disable FortiGate automatic update.
61 - disable - Disable device automatic update.
62 - enable - Enable device automatic update.
63 choices: ['disable', 'enable']
64 banner_message:
65 aliases: ['banner-message']
66 type: str
67 description: Banner message.
68 chassis_mgmt:
69 aliases: ['chassis-mgmt']
70 type: str
71 description:
72 - Enable or disable chassis management.
73 - disable - Disable setting.
74 - enable - Enable setting.
75 choices: ['disable', 'enable']
76 chassis_update_interval:
77 aliases: ['chassis-update-interval']
78 type: int
79 description: Chassis background update interval
80 device_sync_status:
81 type: str
82 description:
83 - Enable/disable device synchronization status indication.
84 - disable - Disable setting.
85 - enable - Enable setting.
86 choices: ['disable', 'enable']
87 gui_theme:
88 aliases: ['gui-theme']
89 type: str
90 description:
91 - Color scheme to use for the administration GUI.
92 - blue - Blueberry
93 - green - Kiwi
94 - red - Cherry
95 - melongene - Plum
96 - spring - Spring
97 - summer - Summer
98 - autumn - Autumn
99 - winter - Winter
100 - space - Space
101 - calla-lily - Calla Lily
102 - binary-tunnel - Binary Tunnel
103 - diving - Diving
104 - dreamy - Dreamy
105 - technology - Technology
106 - landscape - Landscape
107 - twilight - Twilight
108 - canyon - Canyon
109 - northern-light - Northern Light
110 - astronomy - Astronomy
111 - fish - Fish
112 - penguin - Penguin
113 - panda - Panda
114 - polar-bear - Polar Bear
115 - parrot - Parrot
116 - cave - Cave
117 choices: ['blue', 'green', 'red', 'melongene', 'spring', 'summer', 'autumn',
118 'winter', 'space', 'calla-lily', 'binary-tunnel', 'diving', 'dreamy',
119 'technology', 'landscape', 'twilight', 'canyon', 'northern-light',
120 'astronomy', 'fish', 'penguin', 'panda', 'polar-bear', 'parrot', 'cave',
121 'mountain', 'zebra', 'contrast-dark', 'circuit-board', 'mars',
122 'blue-sea', 'mariner', 'jade', 'neutrino', 'dark-matter', 'forest',
123 'cat', 'graphite']
124 http_port:
125 type: int
126 description: HTTP port.
127 https_port:
128 type: int
129 description: HTTPS port.
130 idle_timeout:
131 type: int
132 description: Idle timeout
133 install_ifpolicy_only:
134 aliases: ['install-ifpolicy-only']
135 type: str
136 description:
137 - Allow install interface policy only.
138 - disable - Disable setting.
139 - enable - Enable setting.
140 choices: ['disable', 'enable']
141 mgmt_addr:
142 aliases: ['mgmt-addr']
143 type: str
144 description: IP of FortiManager used by FGFM.
145 mgmt_fqdn:
146 aliases: ['mgmt-fqdn']
147 type: str
148 description: FQDN of FortiManager used by FGFM.
149 objects_force_deletion:
150 aliases: ['objects-force-deletion']
151 type: str
152 description:
153 - Enable/disable used objects force deletion.
154 - disable - Disable setting.
155 - enable - Enable setting.
156 choices: ['disable', 'enable']
157 offline_mode:
158 type: str
159 description:
160 - Enable/disable offline mode.
161 - disable - Disable offline mode.
162 - enable - Enable offline mode.
163 choices: ['disable', 'enable']
164 register_passwd:
165 type: raw
166 description: (list) Password for register a device.
167 sdwan_monitor_history:
168 aliases: ['sdwan-monitor-history']
169 type: str
170 description:
171 - Enable/disable hostname display in the GUI login page.
172 - disable - Disable setting.
173 - enable - Enable setting.
174 choices: ['disable', 'enable']
175 shell_access:
176 aliases: ['shell-access']
177 type: str
178 description:
179 - Enable/disable shell access.
180 - disable - Disable setting.
181 - enable - Enable setting.
182 choices: ['disable', 'enable']
183 shell_password:
184 aliases: ['shell-password']
185 type: raw
186 description: (list) Password for shell access.
187 show_add_multiple:
188 aliases: ['show-add-multiple']
189 type: str
190 description:
191 - Show add multiple button.
192 - disable - Disable setting.
193 - enable - Enable setting.
194 choices: ['disable', 'enable']
195 show_adom_devman:
196 aliases: ['show-adom-devman']
197 type: str
198 description:
199 - Show ADOM device manager tools on GUI.
200 - disable - Hide device manager tools on GUI.
201 - enable - Show device manager tools on GUI.
202 choices: ['disable', 'enable']
203 show_checkbox_in_table:
204 aliases: ['show-checkbox-in-table']
205 type: str
206 description:
207 - Show checkboxs in tables on GUI.
208 - disable - Disable setting.
209 - enable - Enable setting.
210 choices: ['disable', 'enable']
211 show_device_import_export:
212 aliases: ['show-device-import-export']
213 type: str
214 description:
215 - Enable/disable import/export of ADOM, device, and group lists.
216 - disable - Disable setting.
217 - enable - Enable setting.
218 choices: ['disable', 'enable']
219 show_hostname:
220 aliases: ['show-hostname']
221 type: str
222 description:
223 - Enable/disable hostname display in the GUI login page.
224 - disable - Disable setting.
225 - enable - Enable setting.
226 choices: ['disable', 'enable']
227 show_automatic_script:
228 type: str
229 description:
230 - Enable/disable automatic script.
231 - disable - Disable script option.
232 - enable - Enable script option.
233 choices: ['disable', 'enable']
234 show_grouping_script:
235 type: str
236 description:
237 - Enable/disable grouping script.
238 - disable - Disable script option.
239 - enable - Enable script option.
240 choices: ['disable', 'enable']
241 show_schedule_script:
242 type: str
243 description:
244 - Enable or disable schedule script.
245 - disable - Disable script option.
246 - enable - Enable script option.
247 choices: ['disable', 'enable']
248 show_tcl_script:
249 type: str
250 description:
251 - Enable/disable TCL script.
252 - disable - Disable script option.
253 - enable - Enable script option.
254 choices: ['disable', 'enable']
255 unreg_dev_opt:
256 type: str
257 description:
258 - Action to take when unregistered device connects to FortiManager.
259 - add_no_service - Add unregistered devices but deny service requests.
260 - ignore - Ignore unregistered devices.
261 - add_allow_service - Add unregistered devices and allow service requests.
262 choices: ['add_no_service', 'ignore', 'add_allow_service']
263 webadmin_language:
264 type: str
265 description:
266 - Web admin language.
267 - auto_detect - Automatically detect language.
268 - english - English.
269 - simplified_chinese - Simplified Chinese.
270 - traditional_chinese - Traditional Chinese.
271 - japanese - Japanese.
272 - korean - Korean.
273 - spanish - Spanish.
274 choices: ['auto_detect', 'english', 'simplified_chinese', 'traditional_chinese',
275 'japanese', 'korean', 'spanish', 'french']
276 show_fct_manager:
277 aliases: ['show-fct-manager']
278 type: str
279 description:
280 - Enable/disable FCT manager.
281 - disable - Disable setting.
282 - enable - Enable setting.
283 choices: ['disable', 'enable']
284 sdwan_skip_unmapped_input_device:
285 aliases: ['sdwan-skip-unmapped-input-device']
286 type: str
287 description:
288 - Skip unmapped interface for sdwan/rule/input-device instead of report mapping error.
289 - disable - Disable setting.
290 - enable - Enable setting.
291 choices: ['disable', 'enable']
292 auth_addr:
293 aliases: ['auth-addr']
294 type: str
295 description: IP which is used by FGT to authorize FMG.
296 auth_port:
297 aliases: ['auth-port']
298 type: int
299 description: Port which is used by FGT to authorize FMG.
300 idle_timeout_api:
301 type: int
302 description: Idle timeout for API sessions
303 idle_timeout_gui:
304 type: int
305 description: Idle timeout for GUI sessions
306 central_ftgd_local_cat_id:
307 aliases: ['central-ftgd-local-cat-id']
308 type: str
309 description:
310 - Central FortiGuard local category id management, and do not auto assign id during installation.
311 - disable - Disable setting.
312 - enable - Enable setting.
313 choices: ['disable', 'enable']
314 idle_timeout_sso:
315 type: int
316 description: Idle timeout for SSO sessions
317 preferred_fgfm_intf:
318 aliases: ['preferred-fgfm-intf']
319 type: str
320 description: Preferred interface for FGFM connection.
321 traffic_shaping_history:
322 aliases: ['traffic-shaping-history']
323 type: str
324 description:
325 - Enable/disable traffic-shaping-history.
326 - disable - Disable setting.
327 - enable - Enable setting.
328 choices: ['disable', 'enable']
329 fsw_ignore_platform_check:
330 aliases: ['fsw-ignore-platform-check']
331 type: str
332 description:
333 - Enable/disable FortiSwitch Manager switch platform support check.
334 - disable - Disable setting.
335 - enable - Enable setting.
336 choices: ['disable', 'enable']
337 rtm_max_monitor_by_days:
338 aliases: ['rtm-max-monitor-by-days']
339 type: int
340 description: Maximum rtm monitor
341 rtm_temp_file_limit:
342 aliases: ['rtm-temp-file-limit']
343 type: int
344 description: Set rtm monitor temp file limit by hours.
345 firmware_upgrade_check:
346 aliases: ['firmware-upgrade-check']
347 type: str
348 description:
349 - Enable/disable firmware upgrade check.
350 - disable - Disable setting.
351 - enable - Enable setting.
352 choices: ['disable', 'enable']
353 fgt_gui_proxy:
354 aliases: ['fgt-gui-proxy']
355 type: str
356 description:
357 - Enable/disable FortiGate GUI proxy.
358 - disable - Disable setting.
359 - enable - Enable setting.
360 choices: ['disable', 'enable']
361 fgt_gui_proxy_port:
362 aliases: ['fgt-gui-proxy-port']
363 type: int
364 description: FortiGate GUI proxy port.
365 object_threshold_limit:
366 aliases: ['object-threshold-limit']
367 type: str
368 description: Object threshold limit.
369 choices: ['disable', 'enable']
370 object_threshold_limit_value:
371 aliases: ['object-threshold-limit-value']
372 type: int
373 description: Object threshold limit value.
374 rtm_max_monitor_by_size:
375 aliases: ['rtm-max-monitor-by-size']
376 type: int
377 description: Maximum rtm monitor
378 show_sdwan_manager:
379 aliases: ['show-sdwan-manager']
380 type: str
381 description: Show sdwan manager.
382 choices: ['disable', 'enable']
383 admin_scp:
384 aliases: ['admin-scp']
385 type: str
386 description:
387 - Enable/disable admin SCP.
388 - disable - Disable setting.
389 - enable - Enable setting.
390 choices: ['disable', 'enable']
391 '''
392
393 EXAMPLES = '''
394 - name: Example playbook (generated based on argument schema)
395 hosts: fortimanagers
396 connection: httpapi
397 gather_facts: false
398 tasks:
399 - name: Admin setting.
400 fortinet.fortimanager.fmgr_system_admin_setting:
401 # workspace_locking_adom: <global or your adom name>
402 system_admin_setting:
403 # access_banner: <value in [disable, enable]>
404 # admin_https_redirect: <value in [disable, enable]>
405 # admin_login_max: <integer>
406 # admin_server_cert: <string>
407 # allow_register: <value in [disable, enable]>
408 # auto_update: <value in [disable, enable]>
409 # banner_message: <string>
410 # chassis_mgmt: <value in [disable, enable]>
411 # chassis_update_interval: <integer>
412 # device_sync_status: <value in [disable, enable]>
413 # gui_theme: <value in [blue, green, red, ...]>
414 # http_port: <integer>
415 # https_port: <integer>
416 # idle_timeout: <integer>
417 # install_ifpolicy_only: <value in [disable, enable]>
418 # mgmt_addr: <string>
419 # mgmt_fqdn: <string>
420 # objects_force_deletion: <value in [disable, enable]>
421 # offline_mode: <value in [disable, enable]>
422 # register_passwd: <list or string>
423 # sdwan_monitor_history: <value in [disable, enable]>
424 # shell_access: <value in [disable, enable]>
425 # shell_password: <list or string>
426 # show_add_multiple: <value in [disable, enable]>
427 # show_adom_devman: <value in [disable, enable]>
428 # show_checkbox_in_table: <value in [disable, enable]>
429 # show_device_import_export: <value in [disable, enable]>
430 # show_hostname: <value in [disable, enable]>
431 # show_automatic_script: <value in [disable, enable]>
432 # show_grouping_script: <value in [disable, enable]>
433 # show_schedule_script: <value in [disable, enable]>
434 # show_tcl_script: <value in [disable, enable]>
435 # unreg_dev_opt: <value in [add_no_service, ignore, add_allow_service]>
436 # webadmin_language: <value in [auto_detect, english, simplified_chinese, ...]>
437 # show_fct_manager: <value in [disable, enable]>
438 # sdwan_skip_unmapped_input_device: <value in [disable, enable]>
439 # auth_addr: <string>
440 # auth_port: <integer>
441 # idle_timeout_api: <integer>
442 # idle_timeout_gui: <integer>
443 # central_ftgd_local_cat_id: <value in [disable, enable]>
444 # idle_timeout_sso: <integer>
445 # preferred_fgfm_intf: <string>
446 # traffic_shaping_history: <value in [disable, enable]>
447 # fsw_ignore_platform_check: <value in [disable, enable]>
448 # rtm_max_monitor_by_days: <integer>
449 # rtm_temp_file_limit: <integer>
450 # firmware_upgrade_check: <value in [disable, enable]>
451 # fgt_gui_proxy: <value in [disable, enable]>
452 # fgt_gui_proxy_port: <integer>
453 # object_threshold_limit: <value in [disable, enable]>
454 # object_threshold_limit_value: <integer>
455 # rtm_max_monitor_by_size: <integer>
456 # show_sdwan_manager: <value in [disable, enable]>
457 # admin_scp: <value in [disable, enable]>
458 '''
459
460 RETURN = '''
461 meta:
462 description: The result of the request.
463 type: dict
464 returned: always
465 contains:
466 request_url:
467 description: The full url requested.
468 returned: always
469 type: str
470 sample: /sys/login/user
471 response_code:
472 description: The status of api request.
473 returned: always
474 type: int
475 sample: 0
476 response_data:
477 description: The api response.
478 type: list
479 returned: always
480 response_message:
481 description: The descriptive message of the api response.
482 type: str
483 returned: always
484 sample: OK.
485 system_information:
486 description: The information of the target system.
487 type: dict
488 returned: always
489 rc:
490 description: The status the request.
491 type: int
492 returned: always
493 sample: 0
494 version_check_warning:
495 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
496 type: list
497 returned: complex
498 '''
499 from ansible.module_utils.basic import AnsibleModule
500 from ansible.module_utils.connection import Connection
501 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
502 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
503
504
505 def main():
506 urls_list = [
507 '/cli/global/system/admin/setting'
508 ]
509 module_arg_spec = {
510 'system_admin_setting': {
511 'type': 'dict', 'v_range': [['6.0.0', '']],
512 'options': {
513 'access-banner': {'choices': ['disable', 'enable'], 'type': 'str'},
514 'admin-https-redirect': {'choices': ['disable', 'enable'], 'type': 'str'},
515 'admin-login-max': {'type': 'int'},
516 'admin_server_cert': {'type': 'str'},
517 'allow_register': {'choices': ['disable', 'enable'], 'type': 'str'},
518 'auto-update': {'choices': ['disable', 'enable'], 'type': 'str'},
519 'banner-message': {'type': 'str'},
520 'chassis-mgmt': {'choices': ['disable', 'enable'], 'type': 'str'},
521 'chassis-update-interval': {'type': 'int'},
522 'device_sync_status': {'choices': ['disable', 'enable'], 'type': 'str'},
523 'gui-theme': {
524 'choices': [
525 'blue', 'green', 'red', 'melongene', 'spring', 'summer', 'autumn', 'winter', 'space', 'calla-lily', 'binary-tunnel', 'diving',
526 'dreamy', 'technology', 'landscape', 'twilight', 'canyon', 'northern-light', 'astronomy', 'fish', 'penguin', 'panda',
527 'polar-bear', 'parrot', 'cave', 'mountain', 'zebra', 'contrast-dark', 'circuit-board', 'mars', 'blue-sea', 'mariner', 'jade',
528 'neutrino', 'dark-matter', 'forest', 'cat', 'graphite'
529 ],
530 'type': 'str'
531 },
532 'http_port': {'type': 'int'},
533 'https_port': {'type': 'int'},
534 'idle_timeout': {'type': 'int'},
535 'install-ifpolicy-only': {'choices': ['disable', 'enable'], 'type': 'str'},
536 'mgmt-addr': {'type': 'str'},
537 'mgmt-fqdn': {'type': 'str'},
538 'objects-force-deletion': {'choices': ['disable', 'enable'], 'type': 'str'},
539 'offline_mode': {'choices': ['disable', 'enable'], 'type': 'str'},
540 'register_passwd': {'no_log': True, 'type': 'raw'},
541 'sdwan-monitor-history': {'choices': ['disable', 'enable'], 'type': 'str'},
542 'shell-access': {'v_range': [['6.0.0', '7.2.5'], ['7.4.0', '7.4.3']], 'choices': ['disable', 'enable'], 'type': 'str'},
543 'shell-password': {'v_range': [['6.0.0', '7.2.5'], ['7.4.0', '7.4.3']], 'no_log': True, 'type': 'raw'},
544 'show-add-multiple': {'choices': ['disable', 'enable'], 'type': 'str'},
545 'show-adom-devman': {'choices': ['disable', 'enable'], 'type': 'str'},
546 'show-checkbox-in-table': {'choices': ['disable', 'enable'], 'type': 'str'},
547 'show-device-import-export': {'choices': ['disable', 'enable'], 'type': 'str'},
548 'show-hostname': {'choices': ['disable', 'enable'], 'type': 'str'},
549 'show_automatic_script': {'choices': ['disable', 'enable'], 'type': 'str'},
550 'show_grouping_script': {'choices': ['disable', 'enable'], 'type': 'str'},
551 'show_schedule_script': {'choices': ['disable', 'enable'], 'type': 'str'},
552 'show_tcl_script': {'choices': ['disable', 'enable'], 'type': 'str'},
553 'unreg_dev_opt': {'choices': ['add_no_service', 'ignore', 'add_allow_service'], 'type': 'str'},
554 'webadmin_language': {
555 'choices': ['auto_detect', 'english', 'simplified_chinese', 'traditional_chinese', 'japanese', 'korean', 'spanish', 'french'],
556 'type': 'str'
557 },
558 'show-fct-manager': {'v_range': [['6.4.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
559 'sdwan-skip-unmapped-input-device': {'v_range': [['6.4.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
560 'auth-addr': {'v_range': [['7.0.0', '']], 'type': 'str'},
561 'auth-port': {'v_range': [['7.0.0', '']], 'type': 'int'},
562 'idle_timeout_api': {'v_range': [['6.4.6', '']], 'type': 'int'},
563 'idle_timeout_gui': {'v_range': [['6.4.6', '']], 'type': 'int'},
564 'central-ftgd-local-cat-id': {'v_range': [['6.4.6', '6.4.15'], ['7.0.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
565 'idle_timeout_sso': {'v_range': [['7.0.3', '']], 'type': 'int'},
566 'preferred-fgfm-intf': {'v_range': [['7.0.2', '']], 'type': 'str'},
567 'traffic-shaping-history': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
568 'fsw-ignore-platform-check': {'v_range': [['7.0.7', '7.0.16'], ['7.2.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
569 'rtm-max-monitor-by-days': {'v_range': [['7.2.2', '']], 'type': 'int'},
570 'rtm-temp-file-limit': {'v_range': [['7.2.2', '']], 'type': 'int'},
571 'firmware-upgrade-check': {'v_range': [['7.2.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
572 'fgt-gui-proxy': {'v_range': [['7.4.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
573 'fgt-gui-proxy-port': {'v_range': [['7.4.2', '']], 'type': 'int'},
574 'object-threshold-limit': {'v_range': [['7.6.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
575 'object-threshold-limit-value': {'v_range': [['7.6.2', '']], 'type': 'int'},
576 'rtm-max-monitor-by-size': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'type': 'int'},
577 'show-sdwan-manager': {'v_range': [['7.6.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
578 'admin-scp': {'v_range': [['7.4.8', '7.4.10'], ['7.6.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
579 }
580 }
581 }
582
583 module_option_spec = get_module_arg_spec('partial crud')
584 module_arg_spec.update(module_option_spec)
585 check_galaxy_version(module_arg_spec)
586 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_admin_setting'),
587 supports_check_mode=True)
588 if not module._socket_path:
589 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
590 connection = Connection(module._socket_path)
591 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
592 None, 'data', module, connection)
593 fmgr.process_partial_crud()
594 module.exit_json(meta=module.params)
595
596
597 if __name__ == '__main__':
598 main()