Debian Codegraph @

ansible_collections/fortinet/fortios/plugins/modules/fortios_system_settings.py

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3
4 # Copyright: (c) 2022 Fortinet
5 # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
6 #
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11
12 __metaclass__ = type
13
14 ANSIBLE_METADATA = {
15 "status": ["preview"],
16 "supported_by": "community",
17 "metadata_version": "1.1",
18 }
19
20 DOCUMENTATION = """
21 ---
22 module: fortios_system_settings
23 short_description: Configure VDOM settings in Fortinet's FortiOS and FortiGate.
24 description:
25 - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the
26 user to set and modify system feature and settings category.
27 Examples include all parameters and values need to be adjusted to datasources before usage.
28 Tested with FOS v6.0.0
29 version_added: "2.0.0"
30 author:
31 - Link Zheng (@chillancezen)
32 - Jie Xue (@JieX19)
33 - Hongbin Lu (@fgtdev-hblu)
34 - Frank Shen (@frankshen01)
35 - Miguel Angel Munoz (@mamunozgonzalez)
36 - Nicolas Thomas (@thomnico)
37 notes:
38 - Legacy fortiosapi has been deprecated, httpapi is the preferred way to run playbooks
39
40 - The module supports check_mode.
41
42 requirements:
43 - ansible>=2.16
44 options:
45 access_token:
46 description:
47 - Token-based authentication.
48 Generated from GUI of Fortigate.
49 type: str
50 required: false
51 enable_log:
52 description:
53 - Enable/Disable logging for task.
54 type: bool
55 required: false
56 default: false
57 vdom:
58 description:
59 - Virtual domain, among those defined previously. A vdom is a
60 virtual instance of the FortiGate that can be configured and
61 used as a different unit.
62 type: str
63 default: root
64 member_path:
65 type: str
66 description:
67 - Member attribute path to operate on.
68 - Delimited by a slash character if there are more than one attribute.
69 - Parameter marked with member_path is legitimate for doing member operation.
70 member_state:
71 type: str
72 description:
73 - Add or delete a member under specified attribute path.
74 - When member_state is specified, the state option is ignored.
75 choices:
76 - 'present'
77 - 'absent'
78
79 system_settings:
80 description:
81 - Configure VDOM settings.
82 default: null
83 type: dict
84 suboptions:
85 allow_linkdown_path:
86 description:
87 - Enable/disable link down path.
88 type: str
89 choices:
90 - 'enable'
91 - 'disable'
92 allow_subnet_overlap:
93 description:
94 - Enable/disable allowing interface subnets to use overlapping IP addresses.
95 type: str
96 choices:
97 - 'enable'
98 - 'disable'
99 application_bandwidth_tracking:
100 description:
101 - Enable/disable application bandwidth tracking.
102 type: str
103 choices:
104 - 'disable'
105 - 'enable'
106 asymroute:
107 description:
108 - Enable/disable IPv4 asymmetric routing.
109 type: str
110 choices:
111 - 'enable'
112 - 'disable'
113 asymroute_icmp:
114 description:
115 - Enable/disable ICMP asymmetric routing.
116 type: str
117 choices:
118 - 'enable'
119 - 'disable'
120 asymroute6:
121 description:
122 - Enable/disable asymmetric IPv6 routing.
123 type: str
124 choices:
125 - 'enable'
126 - 'disable'
127 asymroute6_icmp:
128 description:
129 - Enable/disable asymmetric ICMPv6 routing.
130 type: str
131 choices:
132 - 'enable'
133 - 'disable'
134 auxiliary_session:
135 description:
136 - Enable/disable auxiliary session.
137 type: str
138 choices:
139 - 'enable'
140 - 'disable'
141 bfd:
142 description:
143 - Enable/disable Bi-directional Forwarding Detection (BFD) on all interfaces.
144 type: str
145 choices:
146 - 'enable'
147 - 'disable'
148 bfd_desired_min_tx:
149 description:
150 - BFD desired minimal transmit interval (1 - 100000 ms).
151 type: int
152 bfd_detect_mult:
153 description:
154 - BFD detection multiplier (1 - 50).
155 type: int
156 bfd_dont_enforce_src_port:
157 description:
158 - Enable to not enforce verifying the source port of BFD Packets.
159 type: str
160 choices:
161 - 'enable'
162 - 'disable'
163 bfd_required_min_rx:
164 description:
165 - BFD required minimal receive interval (1 - 100000 ms).
166 type: int
167 block_land_attack:
168 description:
169 - Enable/disable blocking of land attacks.
170 type: str
171 choices:
172 - 'disable'
173 - 'enable'
174 central_nat:
175 description:
176 - Enable/disable central NAT.
177 type: str
178 choices:
179 - 'enable'
180 - 'disable'
181 comments:
182 description:
183 - VDOM comments.
184 type: str
185 compliance_check:
186 description:
187 - Enable/disable PCI DSS compliance checking.
188 type: str
189 choices:
190 - 'enable'
191 - 'disable'
192 consolidated_firewall_mode:
193 description:
194 - Consolidated firewall mode.
195 type: str
196 choices:
197 - 'enable'
198 - 'disable'
199 default_app_port_as_service:
200 description:
201 - Enable/disable policy service enforcement based on application default ports.
202 type: str
203 choices:
204 - 'enable'
205 - 'disable'
206 default_policy_expiry_days:
207 description:
208 - Default policy expiry in days (0 - 365 days).
209 type: int
210 default_voip_alg_mode:
211 description:
212 - Configure how the FortiGate handles VoIP traffic when a policy that accepts the traffic doesn"t include a VoIP profile.
213 type: str
214 choices:
215 - 'proxy-based'
216 - 'kernel-helper-based'
217 deny_tcp_with_icmp:
218 description:
219 - Enable/disable denying TCP by sending an ICMP communication prohibited packet.
220 type: str
221 choices:
222 - 'enable'
223 - 'disable'
224 detect_unknown_esp:
225 description:
226 - Enable/disable detection of unknown ESP packets .
227 type: str
228 choices:
229 - 'enable'
230 - 'disable'
231 device:
232 description:
233 - Interface to use for management access for NAT mode. Source system.interface.name.
234 type: str
235 dhcp_proxy:
236 description:
237 - Enable/disable the DHCP Proxy.
238 type: str
239 choices:
240 - 'enable'
241 - 'disable'
242 dhcp_proxy_interface:
243 description:
244 - Specify outgoing interface to reach server. Source system.interface.name.
245 type: str
246 dhcp_proxy_interface_select_method:
247 description:
248 - Specify how to select outgoing interface to reach server.
249 type: str
250 choices:
251 - 'auto'
252 - 'sdwan'
253 - 'specify'
254 dhcp_proxy_vrf_select:
255 description:
256 - VRF ID used for connection to server.
257 type: int
258 dhcp_server_ip:
259 description:
260 - DHCP Server IPv4 address.
261 type: list
262 elements: str
263 dhcp6_server_ip:
264 description:
265 - DHCPv6 server IPv6 address.
266 type: list
267 elements: str
268 discovered_device_timeout:
269 description:
270 - Timeout for discovered devices (1 - 365 days).
271 type: int
272 dyn_addr_session_check:
273 description:
274 - Enable/disable dirty session check caused by dynamic address updates.
275 type: str
276 choices:
277 - 'enable'
278 - 'disable'
279 ecmp_max_paths:
280 description:
281 - Maximum number of Equal Cost Multi-Path (ECMP) next-hops. Set to 1 to disable ECMP routing (1 - 255).
282 type: int
283 email_portal_check_dns:
284 description:
285 - Enable/disable using DNS to validate email addresses collected by a captive portal.
286 type: str
287 choices:
288 - 'disable'
289 - 'enable'
290 ext_resource_session_check:
291 description:
292 - Enable/disable dirty session check caused by external resource updates.
293 type: str
294 choices:
295 - 'enable'
296 - 'disable'
297 firewall_session_dirty:
298 description:
299 - Select how to manage sessions affected by firewall policy configuration changes.
300 type: str
301 choices:
302 - 'check-all'
303 - 'check-new'
304 - 'check-policy-option'
305 fqdn_session_check:
306 description:
307 - Enable/disable dirty session check caused by FQDN updates.
308 type: str
309 choices:
310 - 'enable'
311 - 'disable'
312 fw_session_hairpin:
313 description:
314 - Enable/disable checking for a matching policy each time hairpin traffic goes through the FortiGate.
315 type: str
316 choices:
317 - 'enable'
318 - 'disable'
319 gateway:
320 description:
321 - Transparent mode IPv4 default gateway IP address.
322 type: str
323 gateway6:
324 description:
325 - Transparent mode IPv6 default gateway IP address.
326 type: str
327 gtp_asym_fgsp:
328 description:
329 - Enable/disable GTP asymmetric traffic handling on FGSP.
330 type: str
331 choices:
332 - 'disable'
333 - 'enable'
334 gtp_monitor_mode:
335 description:
336 - Enable/disable GTP monitor mode (VDOM level).
337 type: str
338 choices:
339 - 'enable'
340 - 'disable'
341 gui_advanced_policy:
342 description:
343 - Enable/disable advanced policy configuration on the GUI.
344 type: str
345 choices:
346 - 'enable'
347 - 'disable'
348 gui_advanced_wireless_features:
349 description:
350 - Enable/disable advanced wireless features in GUI.
351 type: str
352 choices:
353 - 'enable'
354 - 'disable'
355 gui_allow_unnamed_policy:
356 description:
357 - Enable/disable the requirement for policy naming on the GUI.
358 type: str
359 choices:
360 - 'enable'
361 - 'disable'
362 gui_antivirus:
363 description:
364 - Enable/disable AntiVirus on the GUI.
365 type: str
366 choices:
367 - 'enable'
368 - 'disable'
369 gui_ap_profile:
370 description:
371 - Enable/disable FortiAP profiles on the GUI.
372 type: str
373 choices:
374 - 'enable'
375 - 'disable'
376 gui_application_control:
377 description:
378 - Enable/disable application control on the GUI.
379 type: str
380 choices:
381 - 'enable'
382 - 'disable'
383 gui_casb:
384 description:
385 - Enable/disable Inline-CASB on the GUI.
386 type: str
387 choices:
388 - 'enable'
389 - 'disable'
390 gui_default_policy_columns:
391 description:
392 - Default columns to display for policy lists on GUI.
393 type: list
394 elements: dict
395 suboptions:
396 name:
397 description:
398 - Select column name.
399 required: true
400 type: str
401 gui_dhcp_advanced:
402 description:
403 - Enable/disable advanced DHCP options on the GUI.
404 type: str
405 choices:
406 - 'enable'
407 - 'disable'
408 gui_dlp:
409 description:
410 - Enable/disable DLP on the GUI.
411 type: str
412 choices:
413 - 'enable'
414 - 'disable'
415 gui_dlp_advanced:
416 description:
417 - Enable/disable Show advanced DLP expressions on the GUI.
418 type: str
419 choices:
420 - 'enable'
421 - 'disable'
422 gui_dlp_profile:
423 description:
424 - Enable/disable Data Loss Prevention on the GUI.
425 type: str
426 choices:
427 - 'enable'
428 - 'disable'
429 gui_dns_database:
430 description:
431 - Enable/disable DNS database settings on the GUI.
432 type: str
433 choices:
434 - 'enable'
435 - 'disable'
436 gui_dnsfilter:
437 description:
438 - Enable/disable DNS Filtering on the GUI.
439 type: str
440 choices:
441 - 'enable'
442 - 'disable'
443 gui_domain_ip_reputation:
444 description:
445 - Enable/disable Domain and IP Reputation on the GUI.
446 type: str
447 choices:
448 - 'enable'
449 - 'disable'
450 gui_dos_policy:
451 description:
452 - Enable/disable DoS policies on the GUI.
453 type: str
454 choices:
455 - 'enable'
456 - 'disable'
457 gui_dynamic_device_os_id:
458 description:
459 - Enable/disable Create dynamic addresses to manage known devices.
460 type: str
461 choices:
462 - 'enable'
463 - 'disable'
464 gui_dynamic_profile_display:
465 description:
466 - Enable/disable RADIUS Single Sign On (RSSO) on the GUI.
467 type: str
468 choices:
469 - 'enable'
470 - 'disable'
471 gui_dynamic_routing:
472 description:
473 - Enable/disable dynamic routing on the GUI.
474 type: str
475 choices:
476 - 'enable'
477 - 'disable'
478 gui_email_collection:
479 description:
480 - Enable/disable email collection on the GUI.
481 type: str
482 choices:
483 - 'enable'
484 - 'disable'
485 gui_endpoint_control:
486 description:
487 - Enable/disable endpoint control on the GUI.
488 type: str
489 choices:
490 - 'enable'
491 - 'disable'
492 gui_endpoint_control_advanced:
493 description:
494 - Enable/disable advanced endpoint control options on the GUI.
495 type: str
496 choices:
497 - 'enable'
498 - 'disable'
499 gui_enforce_change_summary:
500 description:
501 - Enforce change summaries for select tables in the GUI.
502 type: str
503 choices:
504 - 'disable'
505 - 'require'
506 - 'optional'
507 gui_explicit_proxy:
508 description:
509 - Enable/disable the explicit proxy on the GUI.
510 type: str
511 choices:
512 - 'enable'
513 - 'disable'
514 gui_file_filter:
515 description:
516 - Enable/disable File-filter on the GUI.
517 type: str
518 choices:
519 - 'enable'
520 - 'disable'
521 gui_fortiap_split_tunneling:
522 description:
523 - Enable/disable FortiAP split tunneling on the GUI.
524 type: str
525 choices:
526 - 'enable'
527 - 'disable'
528 gui_fortiextender_controller:
529 description:
530 - Enable/disable FortiExtender on the GUI.
531 type: str
532 choices:
533 - 'enable'
534 - 'disable'
535 gui_fortitelemetry:
536 description:
537 - Enable/disable FortiTelemetry on the GUI.
538 type: str
539 choices:
540 - 'enable'
541 - 'disable'
542 gui_gtp:
543 description:
544 - Enable/disable Manage general radio packet service (GPRS) protocols on the GUI.
545 type: str
546 choices:
547 - 'enable'
548 - 'disable'
549 gui_icap:
550 description:
551 - Enable/disable ICAP on the GUI.
552 type: str
553 choices:
554 - 'enable'
555 - 'disable'
556 gui_implicit_policy:
557 description:
558 - Enable/disable implicit firewall policies on the GUI.
559 type: str
560 choices:
561 - 'enable'
562 - 'disable'
563 gui_ips:
564 description:
565 - Enable/disable IPS on the GUI.
566 type: str
567 choices:
568 - 'enable'
569 - 'disable'
570 gui_load_balance:
571 description:
572 - Enable/disable server load balancing on the GUI.
573 type: str
574 choices:
575 - 'enable'
576 - 'disable'
577 gui_local_in_policy:
578 description:
579 - Enable/disable Local-In policies on the GUI.
580 type: str
581 choices:
582 - 'enable'
583 - 'disable'
584 gui_local_reports:
585 description:
586 - Enable/disable local reports on the GUI.
587 type: str
588 choices:
589 - 'enable'
590 - 'disable'
591 gui_multicast_policy:
592 description:
593 - Enable/disable multicast firewall policies on the GUI.
594 type: str
595 choices:
596 - 'enable'
597 - 'disable'
598 gui_multiple_interface_policy:
599 description:
600 - Enable/disable adding multiple interfaces to a policy on the GUI.
601 type: str
602 choices:
603 - 'enable'
604 - 'disable'
605 gui_multiple_utm_profiles:
606 description:
607 - Enable/disable multiple UTM profiles on the GUI.
608 type: str
609 choices:
610 - 'enable'
611 - 'disable'
612 gui_nat46_64:
613 description:
614 - Enable/disable NAT46 and NAT64 settings on the GUI.
615 type: str
616 choices:
617 - 'enable'
618 - 'disable'
619 gui_object_colors:
620 description:
621 - Enable/disable object colors on the GUI.
622 type: str
623 choices:
624 - 'enable'
625 - 'disable'
626 gui_ot:
627 description:
628 - Enable/disable Operational technology features on the GUI.
629 type: str
630 choices:
631 - 'enable'
632 - 'disable'
633 gui_per_policy_disclaimer:
634 description:
635 - Enable/disable policy disclaimer on the GUI.
636 type: str
637 choices:
638 - 'enable'
639 - 'disable'
640 gui_policy_based_ipsec:
641 description:
642 - Enable/disable policy-based IPsec VPN on the GUI.
643 type: str
644 choices:
645 - 'enable'
646 - 'disable'
647 gui_policy_disclaimer:
648 description:
649 - Enable/disable policy disclaimer on the GUI.
650 type: str
651 choices:
652 - 'enable'
653 - 'disable'
654 gui_policy_learning:
655 description:
656 - Enable/disable firewall policy learning mode on the GUI.
657 type: str
658 choices:
659 - 'enable'
660 - 'disable'
661 gui_proxy_inspection:
662 description:
663 - Enable/disable the proxy features on the GUI.
664 type: str
665 choices:
666 - 'enable'
667 - 'disable'
668 gui_replacement_message_groups:
669 description:
670 - Enable/disable replacement message groups on the GUI.
671 type: str
672 choices:
673 - 'enable'
674 - 'disable'
675 gui_route_tag_address_creation:
676 description:
677 - Enable/disable route-tag addresses on the GUI.
678 type: str
679 choices:
680 - 'enable'
681 - 'disable'
682 gui_security_profile_group:
683 description:
684 - Enable/disable Security Profile Groups on the GUI.
685 type: str
686 choices:
687 - 'enable'
688 - 'disable'
689 gui_spamfilter:
690 description:
691 - Enable/disable Antispam on the GUI.
692 type: str
693 choices:
694 - 'enable'
695 - 'disable'
696 gui_sslvpn:
697 description:
698 - Enable/disable SSL-VPN settings pages on the GUI.
699 type: str
700 choices:
701 - 'enable'
702 - 'disable'
703 gui_sslvpn_personal_bookmarks:
704 description:
705 - Enable/disable SSL-VPN personal bookmark management on the GUI.
706 type: str
707 choices:
708 - 'enable'
709 - 'disable'
710 gui_sslvpn_realms:
711 description:
712 - Enable/disable SSL-VPN realms on the GUI.
713 type: str
714 choices:
715 - 'enable'
716 - 'disable'
717 gui_switch_controller:
718 description:
719 - Enable/disable the switch controller on the GUI.
720 type: str
721 choices:
722 - 'enable'
723 - 'disable'
724 gui_threat_weight:
725 description:
726 - Enable/disable threat weight on the GUI.
727 type: str
728 choices:
729 - 'enable'
730 - 'disable'
731 gui_traffic_shaping:
732 description:
733 - Enable/disable traffic shaping on the GUI.
734 type: str
735 choices:
736 - 'enable'
737 - 'disable'
738 gui_videofilter:
739 description:
740 - Enable/disable Video filtering on the GUI.
741 type: str
742 choices:
743 - 'enable'
744 - 'disable'
745 gui_virtual_patch_profile:
746 description:
747 - Enable/disable Virtual Patching on the GUI.
748 type: str
749 choices:
750 - 'enable'
751 - 'disable'
752 gui_voip_profile:
753 description:
754 - Enable/disable VoIP profiles on the GUI.
755 type: str
756 choices:
757 - 'enable'
758 - 'disable'
759 gui_vpn:
760 description:
761 - Enable/disable IPsec VPN settings pages on the GUI.
762 type: str
763 choices:
764 - 'enable'
765 - 'disable'
766 gui_waf_profile:
767 description:
768 - Enable/disable Web Application Firewall on the GUI.
769 type: str
770 choices:
771 - 'enable'
772 - 'disable'
773 gui_wan_load_balancing:
774 description:
775 - Enable/disable SD-WAN on the GUI.
776 type: str
777 choices:
778 - 'enable'
779 - 'disable'
780 gui_wanopt_cache:
781 description:
782 - Enable/disable WAN Optimization and Web Caching on the GUI.
783 type: str
784 choices:
785 - 'enable'
786 - 'disable'
787 gui_webfilter:
788 description:
789 - Enable/disable Web filtering on the GUI.
790 type: str
791 choices:
792 - 'enable'
793 - 'disable'
794 gui_webfilter_advanced:
795 description:
796 - Enable/disable advanced web filtering on the GUI.
797 type: str
798 choices:
799 - 'enable'
800 - 'disable'
801 gui_wireless_controller:
802 description:
803 - Enable/disable the wireless controller on the GUI.
804 type: str
805 choices:
806 - 'enable'
807 - 'disable'
808 gui_ztna:
809 description:
810 - Enable/disable Zero Trust Network Access features on the GUI.
811 type: str
812 choices:
813 - 'enable'
814 - 'disable'
815 h323_direct_model:
816 description:
817 - Enable/disable H323 direct model.
818 type: str
819 choices:
820 - 'disable'
821 - 'enable'
822 http_external_dest:
823 description:
824 - Offload HTTP traffic to FortiWeb or FortiCache.
825 type: str
826 choices:
827 - 'fortiweb'
828 - 'forticache'
829 ike_detailed_event_logs:
830 description:
831 - Enable/disable detail log for IKE events.
832 type: str
833 choices:
834 - 'disable'
835 - 'enable'
836 ike_dn_format:
837 description:
838 - Configure IKE ASN.1 Distinguished Name format conventions.
839 type: str
840 choices:
841 - 'with-space'
842 - 'no-space'
843 ike_policy_route:
844 description:
845 - Enable/disable IKE Policy Based Routing (PBR).
846 type: str
847 choices:
848 - 'enable'
849 - 'disable'
850 ike_port:
851 description:
852 - UDP port for IKE/IPsec traffic .
853 type: int
854 ike_quick_crash_detect:
855 description:
856 - Enable/disable IKE quick crash detection (RFC 6290).
857 type: str
858 choices:
859 - 'enable'
860 - 'disable'
861 ike_session_resume:
862 description:
863 - Enable/disable IKEv2 session resumption (RFC 5723).
864 type: str
865 choices:
866 - 'enable'
867 - 'disable'
868 ike_tcp_port:
869 description:
870 - TCP port for IKE/IPsec traffic .
871 type: int
872 implicit_allow_dns:
873 description:
874 - Enable/disable implicitly allowing DNS traffic.
875 type: str
876 choices:
877 - 'enable'
878 - 'disable'
879 inspection_mode:
880 description:
881 - Inspection mode (proxy-based or flow-based).
882 type: str
883 choices:
884 - 'proxy'
885 - 'flow'
886 internet_service_app_ctrl_size:
887 description:
888 - Maximum number of tuple entries (protocol, port, IP address, application ID) stored by the FortiGate unit (0 - 4294967295). A smaller
889 value limits the FortiGate unit from learning about internet applications.
890 type: int
891 internet_service_database_cache:
892 description:
893 - Enable/disable Internet Service database caching.
894 type: str
895 choices:
896 - 'disable'
897 - 'enable'
898 intree_ses_best_route:
899 description:
900 - Force the intree session to always use the best route.
901 type: str
902 choices:
903 - 'force'
904 - 'disable'
905 ip:
906 description:
907 - IP address and netmask.
908 type: str
909 ip6:
910 description:
911 - IPv6 address prefix for NAT mode.
912 type: str
913 lan_extension_controller_addr:
914 description:
915 - Controller IP address or FQDN to connect.
916 type: str
917 lan_extension_controller_port:
918 description:
919 - Controller port to connect.
920 type: int
921 link_down_access:
922 description:
923 - Enable/disable link down access traffic.
924 type: str
925 choices:
926 - 'enable'
927 - 'disable'
928 lldp_reception:
929 description:
930 - Enable/disable Link Layer Discovery Protocol (LLDP) reception for this VDOM or apply global settings to this VDOM.
931 type: str
932 choices:
933 - 'enable'
934 - 'disable'
935 - 'global'
936 lldp_transmission:
937 description:
938 - Enable/disable Link Layer Discovery Protocol (LLDP) transmission for this VDOM or apply global settings to this VDOM.
939 type: str
940 choices:
941 - 'enable'
942 - 'disable'
943 - 'global'
944 location_id:
945 description:
946 - Local location ID in the form of an IPv4 address.
947 type: str
948 mac_ttl:
949 description:
950 - Duration of MAC addresses in Transparent mode (300 - 8640000 sec).
951 type: int
952 manageip:
953 description:
954 - Transparent mode IPv4 management IP address and netmask.
955 type: str
956 manageip6:
957 description:
958 - Transparent mode IPv6 management IP address and netmask.
959 type: str
960 multicast_forward:
961 description:
962 - Enable/disable multicast forwarding.
963 type: str
964 choices:
965 - 'enable'
966 - 'disable'
967 multicast_skip_policy:
968 description:
969 - Enable/disable allowing multicast traffic through the FortiGate without a policy check.
970 type: str
971 choices:
972 - 'enable'
973 - 'disable'
974 multicast_ttl_notchange:
975 description:
976 - Enable/disable preventing the FortiGate from changing the TTL for forwarded multicast packets.
977 type: str
978 choices:
979 - 'enable'
980 - 'disable'
981 nat46_force_ipv4_packet_forwarding:
982 description:
983 - Enable/disable mandatory IPv4 packet forwarding in NAT46.
984 type: str
985 choices:
986 - 'enable'
987 - 'disable'
988 nat46_generate_ipv6_fragment_header:
989 description:
990 - Enable/disable NAT46 IPv6 fragment header generation.
991 type: str
992 choices:
993 - 'enable'
994 - 'disable'
995 nat64_force_ipv6_packet_forwarding:
996 description:
997 - Enable/disable mandatory IPv6 packet forwarding in NAT64.
998 type: str
999 choices:
1000 - 'enable'
1001 - 'disable'
1002 ngfw_mode:
1003 description:
1004 - Next Generation Firewall (NGFW) mode.
1005 type: str
1006 choices:
1007 - 'profile-based'
1008 - 'policy-based'
1009 opmode:
1010 description:
1011 - Firewall operation mode (NAT or Transparent).
1012 type: str
1013 choices:
1014 - 'nat'
1015 - 'transparent'
1016 pfcp_monitor_mode:
1017 description:
1018 - Enable/disable PFCP monitor mode (VDOM level).
1019 type: str
1020 choices:
1021 - 'enable'
1022 - 'disable'
1023 policy_offload_level:
1024 description:
1025 - Configure firewall policy offload level.
1026 type: str
1027 choices:
1028 - 'disable'
1029 - 'dos-offload'
1030 prp_trailer_action:
1031 description:
1032 - Enable/disable action to take on PRP trailer.
1033 type: str
1034 choices:
1035 - 'enable'
1036 - 'disable'
1037 sccp_port:
1038 description:
1039 - TCP port the SCCP proxy monitors for SCCP traffic (0 - 65535).
1040 type: int
1041 sctp_session_without_init:
1042 description:
1043 - Enable/disable SCTP session creation without SCTP INIT.
1044 type: str
1045 choices:
1046 - 'enable'
1047 - 'disable'
1048 ses_denied_multicast_traffic:
1049 description:
1050 - Enable/disable including denied multicast session in the session table.
1051 type: str
1052 choices:
1053 - 'enable'
1054 - 'disable'
1055 ses_denied_traffic:
1056 description:
1057 - Enable/disable including denied session in the session table.
1058 type: str
1059 choices:
1060 - 'enable'
1061 - 'disable'
1062 sip_expectation:
1063 description:
1064 - Enable/disable the SIP kernel session helper to create an expectation for port 5060.
1065 type: str
1066 choices:
1067 - 'enable'
1068 - 'disable'
1069 sip_helper:
1070 description:
1071 - Enable/disable the SIP session helper to process SIP sessions unless SIP sessions are accepted by the SIP application layer gateway
1072 (ALG).
1073 type: str
1074 choices:
1075 - 'enable'
1076 - 'disable'
1077 sip_nat_trace:
1078 description:
1079 - Enable/disable recording the original SIP source IP address when NAT is used.
1080 type: str
1081 choices:
1082 - 'enable'
1083 - 'disable'
1084 sip_ssl_port:
1085 description:
1086 - TCP port the SIP proxy monitors for SIP SSL/TLS traffic (0 - 65535).
1087 type: int
1088 sip_tcp_port:
1089 description:
1090 - TCP port the SIP proxy monitors for SIP traffic (0 - 65535).
1091 type: list
1092 elements: int
1093 sip_udp_port:
1094 description:
1095 - UDP port the SIP proxy monitors for SIP traffic (0 - 65535).
1096 type: list
1097 elements: int
1098 snat_hairpin_traffic:
1099 description:
1100 - Enable/disable source NAT (SNAT) for VIP hairpin traffic.
1101 type: str
1102 choices:
1103 - 'enable'
1104 - 'disable'
1105 ssl_ssh_profile:
1106 description:
1107 - Profile for SSL/SSH inspection. Source firewall.ssl-ssh-profile.name.
1108 type: str
1109 status:
1110 description:
1111 - Enable/disable this VDOM.
1112 type: str
1113 choices:
1114 - 'enable'
1115 - 'disable'
1116 strict_src_check:
1117 description:
1118 - Enable/disable strict source verification.
1119 type: str
1120 choices:
1121 - 'enable'
1122 - 'disable'
1123 tcp_session_without_syn:
1124 description:
1125 - Enable/disable allowing TCP session without SYN flags.
1126 type: str
1127 choices:
1128 - 'enable'
1129 - 'disable'
1130 utf8_spam_tagging:
1131 description:
1132 - Enable/disable converting antispam tags to UTF-8 for better non-ASCII character support.
1133 type: str
1134 choices:
1135 - 'enable'
1136 - 'disable'
1137 v4_ecmp_mode:
1138 description:
1139 - IPv4 Equal-cost multi-path (ECMP) routing and load balancing mode.
1140 type: str
1141 choices:
1142 - 'source-ip-based'
1143 - 'weight-based'
1144 - 'usage-based'
1145 - 'source-dest-ip-based'
1146 vdom_type:
1147 description:
1148 - Vdom type (traffic, lan-extension or admin).
1149 type: str
1150 choices:
1151 - 'traffic'
1152 - 'lan-extension'
1153 - 'admin'
1154 vpn_stats_log:
1155 description:
1156 - Enable/disable periodic VPN log statistics for one or more types of VPN. Separate names with a space.
1157 type: list
1158 elements: str
1159 choices:
1160 - 'ipsec'
1161 - 'pptp'
1162 - 'l2tp'
1163 - 'ssl'
1164 vpn_stats_period:
1165 description:
1166 - Period to send VPN log statistics (0 or 60 - 86400 sec).
1167 type: int
1168 wccp_cache_engine:
1169 description:
1170 - Enable/disable WCCP cache engine.
1171 type: str
1172 choices:
1173 - 'enable'
1174 - 'disable'
1175 """
1176
1177 EXAMPLES = """
1178 - name: Configure VDOM settings.
1179 fortinet.fortios.fortios_system_settings:
1180 vdom: "{{ vdom }}"
1181 system_settings:
1182 allow_linkdown_path: "enable"
1183 allow_subnet_overlap: "enable"
1184 application_bandwidth_tracking: "disable"
1185 asymroute: "enable"
1186 asymroute_icmp: "enable"
1187 asymroute6: "enable"
1188 asymroute6_icmp: "enable"
1189 auxiliary_session: "enable"
1190 bfd: "enable"
1191 bfd_desired_min_tx: "250"
1192 bfd_detect_mult: "3"
1193 bfd_dont_enforce_src_port: "enable"
1194 bfd_required_min_rx: "250"
1195 block_land_attack: "disable"
1196 central_nat: "enable"
1197 comments: "<your_own_value>"
1198 compliance_check: "enable"
1199 consolidated_firewall_mode: "enable"
1200 default_app_port_as_service: "enable"
1201 default_policy_expiry_days: "30"
1202 default_voip_alg_mode: "proxy-based"
1203 deny_tcp_with_icmp: "enable"
1204 detect_unknown_esp: "enable"
1205 device: "<your_own_value> (source system.interface.name)"
1206 dhcp_proxy: "enable"
1207 dhcp_proxy_interface: "<your_own_value> (source system.interface.name)"
1208 dhcp_proxy_interface_select_method: "auto"
1209 dhcp_proxy_vrf_select: "0"
1210 dhcp_server_ip: "<your_own_value>"
1211 dhcp6_server_ip: "<your_own_value>"
1212 discovered_device_timeout: "28"
1213 dyn_addr_session_check: "enable"
1214 ecmp_max_paths: "255"
1215 email_portal_check_dns: "disable"
1216 ext_resource_session_check: "enable"
1217 firewall_session_dirty: "check-all"
1218 fqdn_session_check: "enable"
1219 fw_session_hairpin: "enable"
1220 gateway: "<your_own_value>"
1221 gateway6: "<your_own_value>"
1222 gtp_asym_fgsp: "disable"
1223 gtp_monitor_mode: "enable"
1224 gui_advanced_policy: "enable"
1225 gui_advanced_wireless_features: "enable"
1226 gui_allow_unnamed_policy: "enable"
1227 gui_antivirus: "enable"
1228 gui_ap_profile: "enable"
1229 gui_application_control: "enable"
1230 gui_casb: "enable"
1231 gui_default_policy_columns:
1232 -
1233 name: "default_name_53"
1234 gui_dhcp_advanced: "enable"
1235 gui_dlp: "enable"
1236 gui_dlp_advanced: "enable"
1237 gui_dlp_profile: "enable"
1238 gui_dns_database: "enable"
1239 gui_dnsfilter: "enable"
1240 gui_domain_ip_reputation: "enable"
1241 gui_dos_policy: "enable"
1242 gui_dynamic_device_os_id: "enable"
1243 gui_dynamic_profile_display: "enable"
1244 gui_dynamic_routing: "enable"
1245 gui_email_collection: "enable"
1246 gui_endpoint_control: "enable"
1247 gui_endpoint_control_advanced: "enable"
1248 gui_enforce_change_summary: "disable"
1249 gui_explicit_proxy: "enable"
1250 gui_file_filter: "enable"
1251 gui_fortiap_split_tunneling: "enable"
1252 gui_fortiextender_controller: "enable"
1253 gui_fortitelemetry: "enable"
1254 gui_gtp: "enable"
1255 gui_icap: "enable"
1256 gui_implicit_policy: "enable"
1257 gui_ips: "enable"
1258 gui_load_balance: "enable"
1259 gui_local_in_policy: "enable"
1260 gui_local_reports: "enable"
1261 gui_multicast_policy: "enable"
1262 gui_multiple_interface_policy: "enable"
1263 gui_multiple_utm_profiles: "enable"
1264 gui_nat46_64: "enable"
1265 gui_object_colors: "enable"
1266 gui_ot: "enable"
1267 gui_per_policy_disclaimer: "enable"
1268 gui_policy_based_ipsec: "enable"
1269 gui_policy_disclaimer: "enable"
1270 gui_policy_learning: "enable"
1271 gui_proxy_inspection: "enable"
1272 gui_replacement_message_groups: "enable"
1273 gui_route_tag_address_creation: "enable"
1274 gui_security_profile_group: "enable"
1275 gui_spamfilter: "enable"
1276 gui_sslvpn: "enable"
1277 gui_sslvpn_personal_bookmarks: "enable"
1278 gui_sslvpn_realms: "enable"
1279 gui_switch_controller: "enable"
1280 gui_threat_weight: "enable"
1281 gui_traffic_shaping: "enable"
1282 gui_videofilter: "enable"
1283 gui_virtual_patch_profile: "enable"
1284 gui_voip_profile: "enable"
1285 gui_vpn: "enable"
1286 gui_waf_profile: "enable"
1287 gui_wan_load_balancing: "enable"
1288 gui_wanopt_cache: "enable"
1289 gui_webfilter: "enable"
1290 gui_webfilter_advanced: "enable"
1291 gui_wireless_controller: "enable"
1292 gui_ztna: "enable"
1293 h323_direct_model: "disable"
1294 http_external_dest: "fortiweb"
1295 ike_detailed_event_logs: "disable"
1296 ike_dn_format: "with-space"
1297 ike_policy_route: "enable"
1298 ike_port: "500"
1299 ike_quick_crash_detect: "enable"
1300 ike_session_resume: "enable"
1301 ike_tcp_port: "443"
1302 implicit_allow_dns: "enable"
1303 inspection_mode: "proxy"
1304 internet_service_app_ctrl_size: "32768"
1305 internet_service_database_cache: "disable"
1306 intree_ses_best_route: "force"
1307 ip: "<your_own_value>"
1308 ip6: "<your_own_value>"
1309 lan_extension_controller_addr: "<your_own_value>"
1310 lan_extension_controller_port: "5246"
1311 link_down_access: "enable"
1312 lldp_reception: "enable"
1313 lldp_transmission: "enable"
1314 location_id: "<your_own_value>"
1315 mac_ttl: "300"
1316 manageip: "<your_own_value>"
1317 manageip6: "<your_own_value>"
1318 multicast_forward: "enable"
1319 multicast_skip_policy: "enable"
1320 multicast_ttl_notchange: "enable"
1321 nat46_force_ipv4_packet_forwarding: "enable"
1322 nat46_generate_ipv6_fragment_header: "enable"
1323 nat64_force_ipv6_packet_forwarding: "enable"
1324 ngfw_mode: "profile-based"
1325 opmode: "nat"
1326 pfcp_monitor_mode: "enable"
1327 policy_offload_level: "disable"
1328 prp_trailer_action: "enable"
1329 sccp_port: "2000"
1330 sctp_session_without_init: "enable"
1331 ses_denied_multicast_traffic: "enable"
1332 ses_denied_traffic: "enable"
1333 sip_expectation: "enable"
1334 sip_helper: "enable"
1335 sip_nat_trace: "enable"
1336 sip_ssl_port: "5061"
1337 sip_tcp_port: "<your_own_value>"
1338 sip_udp_port: "<your_own_value>"
1339 snat_hairpin_traffic: "enable"
1340 ssl_ssh_profile: "<your_own_value> (source firewall.ssl-ssh-profile.name)"
1341 status: "enable"
1342 strict_src_check: "enable"
1343 tcp_session_without_syn: "enable"
1344 utf8_spam_tagging: "enable"
1345 v4_ecmp_mode: "source-ip-based"
1346 vdom_type: "traffic"
1347 vpn_stats_log: "ipsec"
1348 vpn_stats_period: "600"
1349 wccp_cache_engine: "enable"
1350 """
1351
1352 RETURN = """
1353 build:
1354 description: Build number of the fortigate image
1355 returned: always
1356 type: str
1357 sample: '1547'
1358 http_method:
1359 description: Last method used to provision the content into FortiGate
1360 returned: always
1361 type: str
1362 sample: 'PUT'
1363 http_status:
1364 description: Last result given by FortiGate on last operation applied
1365 returned: always
1366 type: str
1367 sample: "200"
1368 mkey:
1369 description: Master key (id) used in the last call to FortiGate
1370 returned: success
1371 type: str
1372 sample: "id"
1373 name:
1374 description: Name of the table used to fulfill the request
1375 returned: always
1376 type: str
1377 sample: "urlfilter"
1378 path:
1379 description: Path of the table used to fulfill the request
1380 returned: always
1381 type: str
1382 sample: "webfilter"
1383 revision:
1384 description: Internal revision number
1385 returned: always
1386 type: str
1387 sample: "17.0.2.10658"
1388 serial:
1389 description: Serial number of the unit
1390 returned: always
1391 type: str
1392 sample: "FGVMEVYYQT3AB5352"
1393 status:
1394 description: Indication of the operation's result
1395 returned: always
1396 type: str
1397 sample: "success"
1398 vdom:
1399 description: Virtual domain used
1400 returned: always
1401 type: str
1402 sample: "root"
1403 version:
1404 description: Version of the FortiGate
1405 returned: always
1406 type: str
1407 sample: "v5.6.3"
1408 """
1409 from ansible.module_utils.basic import AnsibleModule
1410 from ansible.module_utils.connection import Connection
1411 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1412 FortiOSHandler,
1413 )
1414 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1415 check_legacy_fortiosapi,
1416 )
1417 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1418 schema_to_module_spec,
1419 )
1420 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1421 check_schema_versioning,
1422 )
1423 from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.common import (
1424 FAIL_SOCKET_MSG,
1425 )
1426 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.data_post_processor import (
1427 remove_invalid_fields,
1428 )
1429 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1430 is_same_comparison,
1431 )
1432 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1433 serialize,
1434 )
1435 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1436 find_current_values,
1437 )
1438 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1439 unify_data_format,
1440 )
1441
1442
1443 def filter_system_settings_data(json):
1444 option_list = [
1445 "allow_linkdown_path",
1446 "allow_subnet_overlap",
1447 "application_bandwidth_tracking",
1448 "asymroute",
1449 "asymroute_icmp",
1450 "asymroute6",
1451 "asymroute6_icmp",
1452 "auxiliary_session",
1453 "bfd",
1454 "bfd_desired_min_tx",
1455 "bfd_detect_mult",
1456 "bfd_dont_enforce_src_port",
1457 "bfd_required_min_rx",
1458 "block_land_attack",
1459 "central_nat",
1460 "comments",
1461 "compliance_check",
1462 "consolidated_firewall_mode",
1463 "default_app_port_as_service",
1464 "default_policy_expiry_days",
1465 "default_voip_alg_mode",
1466 "deny_tcp_with_icmp",
1467 "detect_unknown_esp",
1468 "device",
1469 "dhcp_proxy",
1470 "dhcp_proxy_interface",
1471 "dhcp_proxy_interface_select_method",
1472 "dhcp_proxy_vrf_select",
1473 "dhcp_server_ip",
1474 "dhcp6_server_ip",
1475 "discovered_device_timeout",
1476 "dyn_addr_session_check",
1477 "ecmp_max_paths",
1478 "email_portal_check_dns",
1479 "ext_resource_session_check",
1480 "firewall_session_dirty",
1481 "fqdn_session_check",
1482 "fw_session_hairpin",
1483 "gateway",
1484 "gateway6",
1485 "gtp_asym_fgsp",
1486 "gtp_monitor_mode",
1487 "gui_advanced_policy",
1488 "gui_advanced_wireless_features",
1489 "gui_allow_unnamed_policy",
1490 "gui_antivirus",
1491 "gui_ap_profile",
1492 "gui_application_control",
1493 "gui_casb",
1494 "gui_default_policy_columns",
1495 "gui_dhcp_advanced",
1496 "gui_dlp",
1497 "gui_dlp_advanced",
1498 "gui_dlp_profile",
1499 "gui_dns_database",
1500 "gui_dnsfilter",
1501 "gui_domain_ip_reputation",
1502 "gui_dos_policy",
1503 "gui_dynamic_device_os_id",
1504 "gui_dynamic_profile_display",
1505 "gui_dynamic_routing",
1506 "gui_email_collection",
1507 "gui_endpoint_control",
1508 "gui_endpoint_control_advanced",
1509 "gui_enforce_change_summary",
1510 "gui_explicit_proxy",
1511 "gui_file_filter",
1512 "gui_fortiap_split_tunneling",
1513 "gui_fortiextender_controller",
1514 "gui_fortitelemetry",
1515 "gui_gtp",
1516 "gui_icap",
1517 "gui_implicit_policy",
1518 "gui_ips",
1519 "gui_load_balance",
1520 "gui_local_in_policy",
1521 "gui_local_reports",
1522 "gui_multicast_policy",
1523 "gui_multiple_interface_policy",
1524 "gui_multiple_utm_profiles",
1525 "gui_nat46_64",
1526 "gui_object_colors",
1527 "gui_ot",
1528 "gui_per_policy_disclaimer",
1529 "gui_policy_based_ipsec",
1530 "gui_policy_disclaimer",
1531 "gui_policy_learning",
1532 "gui_proxy_inspection",
1533 "gui_replacement_message_groups",
1534 "gui_route_tag_address_creation",
1535 "gui_security_profile_group",
1536 "gui_spamfilter",
1537 "gui_sslvpn",
1538 "gui_sslvpn_personal_bookmarks",
1539 "gui_sslvpn_realms",
1540 "gui_switch_controller",
1541 "gui_threat_weight",
1542 "gui_traffic_shaping",
1543 "gui_videofilter",
1544 "gui_virtual_patch_profile",
1545 "gui_voip_profile",
1546 "gui_vpn",
1547 "gui_waf_profile",
1548 "gui_wan_load_balancing",
1549 "gui_wanopt_cache",
1550 "gui_webfilter",
1551 "gui_webfilter_advanced",
1552 "gui_wireless_controller",
1553 "gui_ztna",
1554 "h323_direct_model",
1555 "http_external_dest",
1556 "ike_detailed_event_logs",
1557 "ike_dn_format",
1558 "ike_policy_route",
1559 "ike_port",
1560 "ike_quick_crash_detect",
1561 "ike_session_resume",
1562 "ike_tcp_port",
1563 "implicit_allow_dns",
1564 "inspection_mode",
1565 "internet_service_app_ctrl_size",
1566 "internet_service_database_cache",
1567 "intree_ses_best_route",
1568 "ip",
1569 "ip6",
1570 "lan_extension_controller_addr",
1571 "lan_extension_controller_port",
1572 "link_down_access",
1573 "lldp_reception",
1574 "lldp_transmission",
1575 "location_id",
1576 "mac_ttl",
1577 "manageip",
1578 "manageip6",
1579 "multicast_forward",
1580 "multicast_skip_policy",
1581 "multicast_ttl_notchange",
1582 "nat46_force_ipv4_packet_forwarding",
1583 "nat46_generate_ipv6_fragment_header",
1584 "nat64_force_ipv6_packet_forwarding",
1585 "ngfw_mode",
1586 "opmode",
1587 "pfcp_monitor_mode",
1588 "policy_offload_level",
1589 "prp_trailer_action",
1590 "sccp_port",
1591 "sctp_session_without_init",
1592 "ses_denied_multicast_traffic",
1593 "ses_denied_traffic",
1594 "sip_expectation",
1595 "sip_helper",
1596 "sip_nat_trace",
1597 "sip_ssl_port",
1598 "sip_tcp_port",
1599 "sip_udp_port",
1600 "snat_hairpin_traffic",
1601 "ssl_ssh_profile",
1602 "status",
1603 "strict_src_check",
1604 "tcp_session_without_syn",
1605 "utf8_spam_tagging",
1606 "v4_ecmp_mode",
1607 "vdom_type",
1608 "vpn_stats_log",
1609 "vpn_stats_period",
1610 "wccp_cache_engine",
1611 ]
1612
1613 json = remove_invalid_fields(json)
1614 dictionary = {}
1615
1616 for attribute in option_list:
1617 if attribute in json and json[attribute] is not None:
1618 dictionary[attribute] = json[attribute]
1619
1620 return dictionary
1621
1622
1623 def flatten_single_path(data, path, index):
1624 if (
1625 not data
1626 or index == len(path)
1627 or path[index] not in data
1628 or (not data[path[index]] and not isinstance(data[path[index]], list))
1629 ):
1630 return
1631
1632 if index == len(path) - 1:
1633 data[path[index]] = " ".join(str(elem) for elem in data[path[index]])
1634 if len(data[path[index]]) == 0:
1635 data[path[index]] = None
1636 elif isinstance(data[path[index]], list):
1637 for value in data[path[index]]:
1638 flatten_single_path(value, path, index + 1)
1639 else:
1640 flatten_single_path(data[path[index]], path, index + 1)
1641
1642
1643 def flatten_multilists_attributes(data):
1644 multilist_attrs = [
1645 ["vpn_stats_log"],
1646 ["dhcp_server_ip"],
1647 ["dhcp6_server_ip"],
1648 ["sip_tcp_port"],
1649 ["sip_udp_port"],
1650 ]
1651
1652 for attr in multilist_attrs:
1653 flatten_single_path(data, attr, 0)
1654
1655 return data
1656
1657
1658 def underscore_to_hyphen(data):
1659 new_data = None
1660 if isinstance(data, list):
1661 new_data = []
1662 for i, elem in enumerate(data):
1663 new_data.append(underscore_to_hyphen(elem))
1664 elif isinstance(data, dict):
1665 new_data = {}
1666 for k, v in data.items():
1667 new_data[k.replace("_", "-")] = underscore_to_hyphen(v)
1668 else:
1669 return data
1670 return new_data
1671
1672
1673 def system_settings(data, fos, check_mode=False):
1674
1675 state = None
1676 vdom = data["vdom"]
1677 parameters = None
1678 state = data.get("state", None)
1679 system_settings_data = data["system_settings"]
1680
1681 filtered_data = filter_system_settings_data(system_settings_data)
1682 filtered_data = flatten_multilists_attributes(filtered_data)
1683 converted_data = underscore_to_hyphen(filtered_data)
1684
1685 # check_mode starts from here
1686 if check_mode:
1687 diff = {
1688 "before": "",
1689 "after": filtered_data,
1690 }
1691 mkeyname = fos.get_mkeyname(None, None)
1692 mkey = fos.get_mkey("system", "settings", filtered_data, vdom=vdom)
1693 current_data = fos.get(
1694 "system", "settings", vdom=vdom, mkey=mkey, parameters=parameters
1695 )
1696 is_existed = (
1697 current_data
1698 and current_data.get("http_status") == 200
1699 and (
1700 mkeyname
1701 and isinstance(current_data.get("results"), list)
1702 and len(current_data["results"]) > 0
1703 or not mkeyname
1704 and current_data["results"] # global object response
1705 )
1706 )
1707
1708 # 2. if it exists and the state is 'present' then compare current settings with desired
1709 if state == "present" or state is True or state is None:
1710 # for non global modules, mkeyname must exist and it's a new module when mkey is None
1711 if mkeyname is not None and mkey is None:
1712 return False, True, filtered_data, diff
1713
1714 # if mkey exists then compare each other
1715 # record exits and they're matched or not
1716 copied_filtered_data = filtered_data.copy()
1717 copied_filtered_data.pop(mkeyname, None)
1718 unified_filtered_data = unify_data_format(copied_filtered_data)
1719
1720 current_data_results = current_data.get("results", {})
1721 current_config = (
1722 current_data_results[0]
1723 if mkeyname
1724 and isinstance(current_data_results, list)
1725 and len(current_data_results) > 0
1726 else current_data_results
1727 )
1728 if is_existed:
1729 unified_current_values = find_current_values(
1730 unified_filtered_data,
1731 unify_data_format(current_config),
1732 )
1733
1734 is_same = is_same_comparison(
1735 serialize(unified_current_values), serialize(unified_filtered_data)
1736 )
1737
1738 return (
1739 False,
1740 not is_same,
1741 filtered_data,
1742 {"before": unified_current_values, "after": unified_filtered_data},
1743 )
1744
1745 # record does not exist
1746 return False, True, filtered_data, diff
1747
1748 if state == "absent":
1749 if mkey is None:
1750 return (
1751 False,
1752 False,
1753 filtered_data,
1754 {"before": current_data["results"][0], "after": ""},
1755 )
1756
1757 if is_existed:
1758 return (
1759 False,
1760 True,
1761 filtered_data,
1762 {"before": current_data["results"][0], "after": ""},
1763 )
1764 return False, False, filtered_data, {}
1765
1766 return True, False, {"reason: ": "Must provide state parameter"}, {}
1767 # pass post processed data to member operations
1768 # no need to do underscore_to_hyphen since do_member_operation handles it by itself
1769 data_copy = data.copy()
1770 data_copy["system_settings"] = filtered_data
1771 fos.do_member_operation(
1772 "system",
1773 "settings",
1774 data_copy,
1775 )
1776
1777 return fos.set(
1778 "system", "settings", data=converted_data, vdom=vdom, parameters=parameters
1779 )
1780
1781
1782 def is_successful_status(resp):
1783 return (
1784 "status" in resp
1785 and resp["status"] == "success"
1786 or "http_status" in resp
1787 and resp["http_status"] == 200
1788 or "http_method" in resp
1789 and resp["http_method"] == "DELETE"
1790 and resp["http_status"] == 404
1791 )
1792
1793
1794 def fortios_system(data, fos, check_mode):
1795
1796 if data["system_settings"]:
1797 resp = system_settings(data, fos, check_mode)
1798 else:
1799 fos._module.fail_json(msg="missing task body: %s" % ("system_settings"))
1800 if isinstance(resp, tuple) and len(resp) == 4:
1801 return resp
1802 return (
1803 not is_successful_status(resp),
1804 is_successful_status(resp)
1805 and (resp["revision_changed"] if "revision_changed" in resp else True),
1806 resp,
1807 {},
1808 )
1809
1810
1811 versioned_schema = {
1812 "v_range": [["v6.0.0", ""]],
1813 "type": "dict",
1814 "children": {
1815 "comments": {"v_range": [["v6.0.0", ""]], "type": "string"},
1816 "vdom_type": {
1817 "v_range": [["v7.2.0", ""]],
1818 "type": "string",
1819 "options": [
1820 {"value": "traffic"},
1821 {"value": "lan-extension", "v_range": [["v7.2.1", ""]]},
1822 {"value": "admin"},
1823 ],
1824 },
1825 "lan_extension_controller_addr": {
1826 "v_range": [["v7.2.1", ""]],
1827 "type": "string",
1828 },
1829 "lan_extension_controller_port": {
1830 "v_range": [["v7.6.5", ""]],
1831 "type": "integer",
1832 },
1833 "opmode": {
1834 "v_range": [["v6.0.0", ""]],
1835 "type": "string",
1836 "options": [{"value": "nat"}, {"value": "transparent"}],
1837 },
1838 "ngfw_mode": {
1839 "v_range": [["v6.0.0", ""]],
1840 "type": "string",
1841 "options": [{"value": "profile-based"}, {"value": "policy-based"}],
1842 },
1843 "http_external_dest": {
1844 "v_range": [["v6.0.0", ""]],
1845 "type": "string",
1846 "options": [{"value": "fortiweb"}, {"value": "forticache"}],
1847 },
1848 "firewall_session_dirty": {
1849 "v_range": [["v6.0.0", ""]],
1850 "type": "string",
1851 "options": [
1852 {"value": "check-all"},
1853 {"value": "check-new"},
1854 {"value": "check-policy-option"},
1855 ],
1856 },
1857 "manageip": {"v_range": [["v6.0.0", ""]], "type": "string"},
1858 "gateway": {"v_range": [["v6.0.0", ""]], "type": "string"},
1859 "ip": {"v_range": [["v6.0.0", ""]], "type": "string"},
1860 "manageip6": {"v_range": [["v6.0.0", ""]], "type": "string"},
1861 "gateway6": {"v_range": [["v6.0.0", ""]], "type": "string"},
1862 "ip6": {"v_range": [["v6.0.0", ""]], "type": "string"},
1863 "device": {"v_range": [["v6.0.0", ""]], "type": "string"},
1864 "bfd": {
1865 "v_range": [["v6.0.0", ""]],
1866 "type": "string",
1867 "options": [{"value": "enable"}, {"value": "disable"}],
1868 },
1869 "bfd_desired_min_tx": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1870 "bfd_required_min_rx": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1871 "bfd_detect_mult": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1872 "bfd_dont_enforce_src_port": {
1873 "v_range": [["v6.0.0", ""]],
1874 "type": "string",
1875 "options": [{"value": "enable"}, {"value": "disable"}],
1876 },
1877 "utf8_spam_tagging": {
1878 "v_range": [["v6.0.0", ""]],
1879 "type": "string",
1880 "options": [{"value": "enable"}, {"value": "disable"}],
1881 },
1882 "wccp_cache_engine": {
1883 "v_range": [["v6.0.0", ""]],
1884 "type": "string",
1885 "options": [{"value": "enable"}, {"value": "disable"}],
1886 },
1887 "vpn_stats_log": {
1888 "v_range": [["v6.0.0", ""]],
1889 "type": "list",
1890 "options": [
1891 {"value": "ipsec"},
1892 {"value": "pptp"},
1893 {"value": "l2tp"},
1894 {"value": "ssl"},
1895 ],
1896 "multiple_values": True,
1897 "elements": "str",
1898 },
1899 "vpn_stats_period": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1900 "v4_ecmp_mode": {
1901 "v_range": [["v6.0.0", ""]],
1902 "type": "string",
1903 "options": [
1904 {"value": "source-ip-based"},
1905 {"value": "weight-based"},
1906 {"value": "usage-based"},
1907 {"value": "source-dest-ip-based"},
1908 ],
1909 },
1910 "mac_ttl": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1911 "fw_session_hairpin": {
1912 "v_range": [["v6.0.0", ""]],
1913 "type": "string",
1914 "options": [{"value": "enable"}, {"value": "disable"}],
1915 },
1916 "prp_trailer_action": {
1917 "v_range": [["v6.0.0", ""]],
1918 "type": "string",
1919 "options": [{"value": "enable"}, {"value": "disable"}],
1920 },
1921 "snat_hairpin_traffic": {
1922 "v_range": [["v6.0.0", ""]],
1923 "type": "string",
1924 "options": [{"value": "enable"}, {"value": "disable"}],
1925 },
1926 "dhcp_proxy": {
1927 "v_range": [["v6.0.0", ""]],
1928 "type": "string",
1929 "options": [{"value": "enable"}, {"value": "disable"}],
1930 },
1931 "dhcp_proxy_interface_select_method": {
1932 "v_range": [["v6.2.0", "v6.2.0"], ["v6.2.5", "v6.4.0"], ["v6.4.4", ""]],
1933 "type": "string",
1934 "options": [{"value": "auto"}, {"value": "sdwan"}, {"value": "specify"}],
1935 },
1936 "dhcp_proxy_interface": {
1937 "v_range": [["v6.2.0", "v6.2.0"], ["v6.2.5", "v6.4.0"], ["v6.4.4", ""]],
1938 "type": "string",
1939 },
1940 "dhcp_proxy_vrf_select": {"v_range": [["v7.6.1", ""]], "type": "integer"},
1941 "dhcp_server_ip": {
1942 "v_range": [["v6.0.0", ""]],
1943 "type": "list",
1944 "multiple_values": True,
1945 "elements": "str",
1946 },
1947 "dhcp6_server_ip": {
1948 "v_range": [["v6.0.0", ""]],
1949 "type": "list",
1950 "multiple_values": True,
1951 "elements": "str",
1952 },
1953 "central_nat": {
1954 "v_range": [["v6.0.0", ""]],
1955 "type": "string",
1956 "options": [{"value": "enable"}, {"value": "disable"}],
1957 },
1958 "gui_default_policy_columns": {
1959 "type": "list",
1960 "elements": "dict",
1961 "children": {
1962 "name": {
1963 "v_range": [["v6.0.0", ""]],
1964 "type": "string",
1965 "required": True,
1966 }
1967 },
1968 "v_range": [["v6.0.0", ""]],
1969 },
1970 "lldp_reception": {
1971 "v_range": [["v6.2.0", ""]],
1972 "type": "string",
1973 "options": [{"value": "enable"}, {"value": "disable"}, {"value": "global"}],
1974 },
1975 "lldp_transmission": {
1976 "v_range": [["v6.0.0", ""]],
1977 "type": "string",
1978 "options": [{"value": "enable"}, {"value": "disable"}, {"value": "global"}],
1979 },
1980 "link_down_access": {
1981 "v_range": [["v6.0.0", ""]],
1982 "type": "string",
1983 "options": [{"value": "enable"}, {"value": "disable"}],
1984 },
1985 "nat46_generate_ipv6_fragment_header": {
1986 "v_range": [["v7.0.6", "v7.0.12"], ["v7.2.1", ""]],
1987 "type": "string",
1988 "options": [{"value": "enable"}, {"value": "disable"}],
1989 },
1990 "nat46_force_ipv4_packet_forwarding": {
1991 "v_range": [["v7.0.8", "v7.0.12"], ["v7.2.1", ""]],
1992 "type": "string",
1993 "options": [{"value": "enable"}, {"value": "disable"}],
1994 },
1995 "nat64_force_ipv6_packet_forwarding": {
1996 "v_range": [["v7.0.8", "v7.0.12"], ["v7.2.1", ""]],
1997 "type": "string",
1998 "options": [{"value": "enable"}, {"value": "disable"}],
1999 },
2000 "detect_unknown_esp": {
2001 "v_range": [["v7.2.4", ""]],
2002 "type": "string",
2003 "options": [{"value": "enable"}, {"value": "disable"}],
2004 },
2005 "intree_ses_best_route": {
2006 "v_range": [["v7.6.1", ""]],
2007 "type": "string",
2008 "options": [{"value": "force"}, {"value": "disable"}],
2009 },
2010 "auxiliary_session": {
2011 "v_range": [["v6.2.0", ""]],
2012 "type": "string",
2013 "options": [{"value": "enable"}, {"value": "disable"}],
2014 },
2015 "asymroute": {
2016 "v_range": [["v6.0.0", ""]],
2017 "type": "string",
2018 "options": [{"value": "enable"}, {"value": "disable"}],
2019 },
2020 "asymroute_icmp": {
2021 "v_range": [["v6.0.0", ""]],
2022 "type": "string",
2023 "options": [{"value": "enable"}, {"value": "disable"}],
2024 },
2025 "tcp_session_without_syn": {
2026 "v_range": [["v6.0.0", ""]],
2027 "type": "string",
2028 "options": [{"value": "enable"}, {"value": "disable"}],
2029 },
2030 "ses_denied_traffic": {
2031 "v_range": [["v6.0.0", ""]],
2032 "type": "string",
2033 "options": [{"value": "enable"}, {"value": "disable"}],
2034 },
2035 "ses_denied_multicast_traffic": {
2036 "v_range": [["v7.6.1", ""]],
2037 "type": "string",
2038 "options": [{"value": "enable"}, {"value": "disable"}],
2039 },
2040 "strict_src_check": {
2041 "v_range": [["v6.0.0", ""]],
2042 "type": "string",
2043 "options": [{"value": "enable"}, {"value": "disable"}],
2044 },
2045 "allow_linkdown_path": {
2046 "v_range": [["v6.0.0", ""]],
2047 "type": "string",
2048 "options": [{"value": "enable"}, {"value": "disable"}],
2049 },
2050 "asymroute6": {
2051 "v_range": [["v6.0.0", ""]],
2052 "type": "string",
2053 "options": [{"value": "enable"}, {"value": "disable"}],
2054 },
2055 "asymroute6_icmp": {
2056 "v_range": [["v6.0.0", ""]],
2057 "type": "string",
2058 "options": [{"value": "enable"}, {"value": "disable"}],
2059 },
2060 "sctp_session_without_init": {
2061 "v_range": [["v6.2.0", ""]],
2062 "type": "string",
2063 "options": [{"value": "enable"}, {"value": "disable"}],
2064 },
2065 "sip_expectation": {
2066 "v_range": [["v6.2.0", ""]],
2067 "type": "string",
2068 "options": [{"value": "enable"}, {"value": "disable"}],
2069 },
2070 "sip_nat_trace": {
2071 "v_range": [["v6.0.0", ""]],
2072 "type": "string",
2073 "options": [{"value": "enable"}, {"value": "disable"}],
2074 },
2075 "h323_direct_model": {
2076 "v_range": [["v7.0.4", ""]],
2077 "type": "string",
2078 "options": [{"value": "disable"}, {"value": "enable"}],
2079 },
2080 "status": {
2081 "v_range": [["v6.0.0", ""]],
2082 "type": "string",
2083 "options": [{"value": "enable"}, {"value": "disable"}],
2084 },
2085 "sip_tcp_port": {
2086 "v_range": [["v6.0.0", ""]],
2087 "type": "list",
2088 "multiple_values": True,
2089 "elements": "int",
2090 },
2091 "sip_udp_port": {
2092 "v_range": [["v6.0.0", ""]],
2093 "type": "list",
2094 "multiple_values": True,
2095 "elements": "int",
2096 },
2097 "sip_ssl_port": {"v_range": [["v6.0.0", ""]], "type": "integer"},
2098 "sccp_port": {"v_range": [["v6.0.0", ""]], "type": "integer"},
2099 "multicast_forward": {
2100 "v_range": [["v6.0.0", ""]],
2101 "type": "string",
2102 "options": [{"value": "enable"}, {"value": "disable"}],
2103 },
2104 "multicast_ttl_notchange": {
2105 "v_range": [["v6.0.0", ""]],
2106 "type": "string",
2107 "options": [{"value": "enable"}, {"value": "disable"}],
2108 },
2109 "multicast_skip_policy": {
2110 "v_range": [["v6.0.0", ""]],
2111 "type": "string",
2112 "options": [{"value": "enable"}, {"value": "disable"}],
2113 },
2114 "allow_subnet_overlap": {
2115 "v_range": [["v6.0.0", ""]],
2116 "type": "string",
2117 "options": [{"value": "enable"}, {"value": "disable"}],
2118 },
2119 "deny_tcp_with_icmp": {
2120 "v_range": [["v6.0.0", ""]],
2121 "type": "string",
2122 "options": [{"value": "enable"}, {"value": "disable"}],
2123 },
2124 "ecmp_max_paths": {"v_range": [["v6.0.0", ""]], "type": "integer"},
2125 "discovered_device_timeout": {"v_range": [["v6.0.0", ""]], "type": "integer"},
2126 "email_portal_check_dns": {
2127 "v_range": [["v6.0.0", ""]],
2128 "type": "string",
2129 "options": [{"value": "disable"}, {"value": "enable"}],
2130 },
2131 "default_voip_alg_mode": {
2132 "v_range": [["v6.0.0", ""]],
2133 "type": "string",
2134 "options": [{"value": "proxy-based"}, {"value": "kernel-helper-based"}],
2135 },
2136 "gui_icap": {
2137 "v_range": [["v6.0.0", ""]],
2138 "type": "string",
2139 "options": [{"value": "enable"}, {"value": "disable"}],
2140 },
2141 "gui_implicit_policy": {
2142 "v_range": [["v6.0.0", ""]],
2143 "type": "string",
2144 "options": [{"value": "enable"}, {"value": "disable"}],
2145 },
2146 "gui_dns_database": {
2147 "v_range": [["v6.0.0", ""]],
2148 "type": "string",
2149 "options": [{"value": "enable"}, {"value": "disable"}],
2150 },
2151 "gui_load_balance": {
2152 "v_range": [["v6.0.0", ""]],
2153 "type": "string",
2154 "options": [{"value": "enable"}, {"value": "disable"}],
2155 },
2156 "gui_multicast_policy": {
2157 "v_range": [["v6.0.0", ""]],
2158 "type": "string",
2159 "options": [{"value": "enable"}, {"value": "disable"}],
2160 },
2161 "gui_dos_policy": {
2162 "v_range": [["v6.0.0", ""]],
2163 "type": "string",
2164 "options": [{"value": "enable"}, {"value": "disable"}],
2165 },
2166 "gui_object_colors": {
2167 "v_range": [["v6.0.0", ""]],
2168 "type": "string",
2169 "options": [{"value": "enable"}, {"value": "disable"}],
2170 },
2171 "gui_route_tag_address_creation": {
2172 "v_range": [["v7.4.0", ""]],
2173 "type": "string",
2174 "options": [{"value": "enable"}, {"value": "disable"}],
2175 },
2176 "gui_voip_profile": {
2177 "v_range": [["v6.0.0", ""]],
2178 "type": "string",
2179 "options": [{"value": "enable"}, {"value": "disable"}],
2180 },
2181 "gui_ap_profile": {
2182 "v_range": [["v6.0.0", ""]],
2183 "type": "string",
2184 "options": [{"value": "enable"}, {"value": "disable"}],
2185 },
2186 "gui_security_profile_group": {
2187 "v_range": [["v6.4.4", ""]],
2188 "type": "string",
2189 "options": [{"value": "enable"}, {"value": "disable"}],
2190 },
2191 "gui_local_in_policy": {
2192 "v_range": [["v6.0.0", ""]],
2193 "type": "string",
2194 "options": [{"value": "enable"}, {"value": "disable"}],
2195 },
2196 "gui_wanopt_cache": {
2197 "v_range": [["v6.0.0", "v7.4.1"], ["v7.4.3", ""]],
2198 "type": "string",
2199 "options": [
2200 {"value": "enable", "v_range": [["v6.0.0", ""]]},
2201 {"value": "disable", "v_range": [["v6.0.0", ""]]},
2202 ],
2203 },
2204 "gui_explicit_proxy": {
2205 "v_range": [["v6.0.0", ""]],
2206 "type": "string",
2207 "options": [{"value": "enable"}, {"value": "disable"}],
2208 },
2209 "gui_dynamic_routing": {
2210 "v_range": [["v6.0.0", ""]],
2211 "type": "string",
2212 "options": [{"value": "enable"}, {"value": "disable"}],
2213 },
2214 "gui_sslvpn_personal_bookmarks": {
2215 "v_range": [["v6.0.0", ""]],
2216 "type": "string",
2217 "options": [{"value": "enable"}, {"value": "disable"}],
2218 },
2219 "gui_sslvpn_realms": {
2220 "v_range": [["v6.0.0", ""]],
2221 "type": "string",
2222 "options": [{"value": "enable"}, {"value": "disable"}],
2223 },
2224 "gui_policy_based_ipsec": {
2225 "v_range": [["v6.0.0", ""]],
2226 "type": "string",
2227 "options": [{"value": "enable"}, {"value": "disable"}],
2228 },
2229 "gui_threat_weight": {
2230 "v_range": [["v6.0.0", ""]],
2231 "type": "string",
2232 "options": [{"value": "enable"}, {"value": "disable"}],
2233 },
2234 "gui_spamfilter": {
2235 "v_range": [["v6.0.0", ""]],
2236 "type": "string",
2237 "options": [{"value": "enable"}, {"value": "disable"}],
2238 },
2239 "gui_file_filter": {
2240 "v_range": [["v6.4.0", ""]],
2241 "type": "string",
2242 "options": [{"value": "enable"}, {"value": "disable"}],
2243 },
2244 "gui_application_control": {
2245 "v_range": [["v6.0.0", ""]],
2246 "type": "string",
2247 "options": [{"value": "enable"}, {"value": "disable"}],
2248 },
2249 "gui_ips": {
2250 "v_range": [["v6.0.0", ""]],
2251 "type": "string",
2252 "options": [{"value": "enable"}, {"value": "disable"}],
2253 },
2254 "gui_dhcp_advanced": {
2255 "v_range": [["v6.0.0", ""]],
2256 "type": "string",
2257 "options": [{"value": "enable"}, {"value": "disable"}],
2258 },
2259 "gui_vpn": {
2260 "v_range": [["v6.0.0", ""]],
2261 "type": "string",
2262 "options": [{"value": "enable"}, {"value": "disable"}],
2263 },
2264 "gui_sslvpn": {
2265 "v_range": [["v7.4.1", ""]],
2266 "type": "string",
2267 "options": [{"value": "enable"}, {"value": "disable"}],
2268 },
2269 "gui_wireless_controller": {
2270 "v_range": [["v6.0.0", ""]],
2271 "type": "string",
2272 "options": [{"value": "enable"}, {"value": "disable"}],
2273 },
2274 "gui_advanced_wireless_features": {
2275 "v_range": [["v7.2.1", ""]],
2276 "type": "string",
2277 "options": [{"value": "enable"}, {"value": "disable"}],
2278 },
2279 "gui_switch_controller": {
2280 "v_range": [["v6.0.0", ""]],
2281 "type": "string",
2282 "options": [{"value": "enable"}, {"value": "disable"}],
2283 },
2284 "gui_fortiap_split_tunneling": {
2285 "v_range": [["v6.0.0", ""]],
2286 "type": "string",
2287 "options": [{"value": "enable"}, {"value": "disable"}],
2288 },
2289 "gui_webfilter_advanced": {
2290 "v_range": [["v6.0.0", ""]],
2291 "type": "string",
2292 "options": [{"value": "enable"}, {"value": "disable"}],
2293 },
2294 "gui_traffic_shaping": {
2295 "v_range": [["v6.0.0", ""]],
2296 "type": "string",
2297 "options": [{"value": "enable"}, {"value": "disable"}],
2298 },
2299 "gui_wan_load_balancing": {
2300 "v_range": [["v6.0.0", ""]],
2301 "type": "string",
2302 "options": [{"value": "enable"}, {"value": "disable"}],
2303 },
2304 "gui_antivirus": {
2305 "v_range": [["v6.0.0", ""]],
2306 "type": "string",
2307 "options": [{"value": "enable"}, {"value": "disable"}],
2308 },
2309 "gui_webfilter": {
2310 "v_range": [["v6.0.0", ""]],
2311 "type": "string",
2312 "options": [{"value": "enable"}, {"value": "disable"}],
2313 },
2314 "gui_fortitelemetry": {
2315 "v_range": [["v7.6.3", ""]],
2316 "type": "string",
2317 "options": [{"value": "enable"}, {"value": "disable"}],
2318 },
2319 "gui_videofilter": {
2320 "v_range": [["v7.0.0", ""]],
2321 "type": "string",
2322 "options": [{"value": "enable"}, {"value": "disable"}],
2323 },
2324 "gui_dnsfilter": {
2325 "v_range": [["v6.0.0", ""]],
2326 "type": "string",
2327 "options": [{"value": "enable"}, {"value": "disable"}],
2328 },
2329 "gui_waf_profile": {
2330 "v_range": [["v6.0.0", ""]],
2331 "type": "string",
2332 "options": [{"value": "enable"}, {"value": "disable"}],
2333 },
2334 "gui_dlp_profile": {
2335 "v_range": [["v7.2.4", ""]],
2336 "type": "string",
2337 "options": [{"value": "enable"}, {"value": "disable"}],
2338 },
2339 "gui_dlp_advanced": {
2340 "v_range": [["v7.6.1", ""]],
2341 "type": "string",
2342 "options": [{"value": "enable"}, {"value": "disable"}],
2343 },
2344 "gui_virtual_patch_profile": {
2345 "v_range": [["v7.4.1", ""]],
2346 "type": "string",
2347 "options": [{"value": "enable"}, {"value": "disable"}],
2348 },
2349 "gui_casb": {
2350 "v_range": [["v7.4.1", ""]],
2351 "type": "string",
2352 "options": [{"value": "enable"}, {"value": "disable"}],
2353 },
2354 "gui_fortiextender_controller": {
2355 "v_range": [["v6.0.0", ""]],
2356 "type": "string",
2357 "options": [{"value": "enable"}, {"value": "disable"}],
2358 },
2359 "gui_advanced_policy": {
2360 "v_range": [["v6.0.0", ""]],
2361 "type": "string",
2362 "options": [{"value": "enable"}, {"value": "disable"}],
2363 },
2364 "gui_allow_unnamed_policy": {
2365 "v_range": [["v6.0.0", ""]],
2366 "type": "string",
2367 "options": [{"value": "enable"}, {"value": "disable"}],
2368 },
2369 "gui_email_collection": {
2370 "v_range": [["v6.0.0", ""]],
2371 "type": "string",
2372 "options": [{"value": "enable"}, {"value": "disable"}],
2373 },
2374 "gui_multiple_interface_policy": {
2375 "v_range": [["v6.0.0", ""]],
2376 "type": "string",
2377 "options": [{"value": "enable"}, {"value": "disable"}],
2378 },
2379 "gui_policy_disclaimer": {
2380 "v_range": [["v6.4.0", ""]],
2381 "type": "string",
2382 "options": [{"value": "enable"}, {"value": "disable"}],
2383 },
2384 "gui_ztna": {
2385 "v_range": [["v7.0.0", ""]],
2386 "type": "string",
2387 "options": [{"value": "enable"}, {"value": "disable"}],
2388 },
2389 "gui_ot": {
2390 "v_range": [["v7.2.0", ""]],
2391 "type": "string",
2392 "options": [{"value": "enable"}, {"value": "disable"}],
2393 },
2394 "gui_dynamic_device_os_id": {
2395 "v_range": [["v7.4.0", ""]],
2396 "type": "string",
2397 "options": [{"value": "enable"}, {"value": "disable"}],
2398 },
2399 "gui_gtp": {
2400 "v_range": [["v7.6.0", ""]],
2401 "type": "string",
2402 "options": [{"value": "enable"}, {"value": "disable"}],
2403 },
2404 "location_id": {"v_range": [["v7.0.0", ""]], "type": "string"},
2405 "ike_session_resume": {
2406 "v_range": [["v6.0.0", ""]],
2407 "type": "string",
2408 "options": [{"value": "enable"}, {"value": "disable"}],
2409 },
2410 "ike_quick_crash_detect": {
2411 "v_range": [["v6.0.0", ""]],
2412 "type": "string",
2413 "options": [{"value": "enable"}, {"value": "disable"}],
2414 },
2415 "ike_dn_format": {
2416 "v_range": [["v6.0.0", ""]],
2417 "type": "string",
2418 "options": [{"value": "with-space"}, {"value": "no-space"}],
2419 },
2420 "ike_port": {"v_range": [["v7.0.0", ""]], "type": "integer"},
2421 "ike_tcp_port": {"v_range": [["v7.4.2", ""]], "type": "integer"},
2422 "ike_policy_route": {
2423 "v_range": [["v7.0.2", ""]],
2424 "type": "string",
2425 "options": [{"value": "enable"}, {"value": "disable"}],
2426 },
2427 "ike_detailed_event_logs": {
2428 "v_range": [["v7.6.3", ""]],
2429 "type": "string",
2430 "options": [{"value": "disable"}, {"value": "enable"}],
2431 },
2432 "block_land_attack": {
2433 "v_range": [["v6.0.0", ""]],
2434 "type": "string",
2435 "options": [{"value": "disable"}, {"value": "enable"}],
2436 },
2437 "default_app_port_as_service": {
2438 "v_range": [["v7.2.0", ""]],
2439 "type": "string",
2440 "options": [{"value": "enable"}, {"value": "disable"}],
2441 },
2442 "gtp_asym_fgsp": {
2443 "v_range": [["v6.2.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2444 "type": "string",
2445 "options": [{"value": "disable"}, {"value": "enable"}],
2446 },
2447 "gtp_monitor_mode": {
2448 "v_range": [["v6.2.0", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2449 "type": "string",
2450 "options": [{"value": "enable"}, {"value": "disable"}],
2451 },
2452 "pfcp_monitor_mode": {
2453 "v_range": [["v7.0.1", "v7.0.8"], ["v7.2.0", "v7.2.4"], ["v7.4.3", ""]],
2454 "type": "string",
2455 "options": [{"value": "enable"}, {"value": "disable"}],
2456 },
2457 "fqdn_session_check": {
2458 "v_range": [["v7.2.1", ""]],
2459 "type": "string",
2460 "options": [{"value": "enable"}, {"value": "disable"}],
2461 },
2462 "ext_resource_session_check": {
2463 "v_range": [["v7.2.1", ""]],
2464 "type": "string",
2465 "options": [{"value": "enable"}, {"value": "disable"}],
2466 },
2467 "dyn_addr_session_check": {
2468 "v_range": [["v7.2.1", ""]],
2469 "type": "string",
2470 "options": [{"value": "enable"}, {"value": "disable"}],
2471 },
2472 "default_policy_expiry_days": {"v_range": [["v7.2.0", ""]], "type": "integer"},
2473 "gui_enforce_change_summary": {
2474 "v_range": [["v7.2.0", ""]],
2475 "type": "string",
2476 "options": [
2477 {"value": "disable"},
2478 {"value": "require"},
2479 {"value": "optional"},
2480 ],
2481 },
2482 "internet_service_database_cache": {
2483 "v_range": [["v7.2.4", ""]],
2484 "type": "string",
2485 "options": [{"value": "disable"}, {"value": "enable"}],
2486 },
2487 "internet_service_app_ctrl_size": {
2488 "v_range": [["v7.4.4", ""]],
2489 "type": "integer",
2490 },
2491 "application_bandwidth_tracking": {
2492 "v_range": [["v7.0.0", "v7.6.0"]],
2493 "type": "string",
2494 "options": [{"value": "disable"}, {"value": "enable"}],
2495 },
2496 "gui_proxy_inspection": {
2497 "v_range": [["v7.2.4", "v7.4.4"]],
2498 "type": "string",
2499 "options": [{"value": "enable"}, {"value": "disable"}],
2500 },
2501 "policy_offload_level": {
2502 "v_range": [["v7.4.2", "v7.4.2"]],
2503 "type": "string",
2504 "options": [{"value": "disable"}, {"value": "dos-offload"}],
2505 },
2506 "gui_endpoint_control": {
2507 "v_range": [["v6.0.0", "v7.2.4"]],
2508 "type": "string",
2509 "options": [{"value": "enable"}, {"value": "disable"}],
2510 },
2511 "gui_endpoint_control_advanced": {
2512 "v_range": [["v6.0.0", "v7.2.4"]],
2513 "type": "string",
2514 "options": [{"value": "enable"}, {"value": "disable"}],
2515 },
2516 "gui_local_reports": {
2517 "v_range": [["v6.0.0", "v7.2.2"]],
2518 "type": "string",
2519 "options": [{"value": "enable"}, {"value": "disable"}],
2520 },
2521 "gui_nat46_64": {
2522 "v_range": [["v6.0.0", "v7.0.0"]],
2523 "type": "string",
2524 "options": [{"value": "enable"}, {"value": "disable"}],
2525 },
2526 "gui_replacement_message_groups": {
2527 "v_range": [["v6.0.0", "v6.4.4"]],
2528 "type": "string",
2529 "options": [{"value": "enable"}, {"value": "disable"}],
2530 },
2531 "gui_dynamic_profile_display": {
2532 "v_range": [["v6.0.0", "v6.4.1"]],
2533 "type": "string",
2534 "options": [{"value": "enable"}, {"value": "disable"}],
2535 },
2536 "gui_multiple_utm_profiles": {
2537 "v_range": [["v6.0.0", "v6.2.7"], ["v6.4.1", "v6.4.1"]],
2538 "type": "string",
2539 "options": [{"value": "enable"}, {"value": "disable"}],
2540 },
2541 "gui_domain_ip_reputation": {
2542 "v_range": [["v6.0.0", "v6.2.7"], ["v6.4.1", "v6.4.1"]],
2543 "type": "string",
2544 "options": [{"value": "enable"}, {"value": "disable"}],
2545 },
2546 "implicit_allow_dns": {
2547 "v_range": [["v6.0.0", "v6.2.7"]],
2548 "type": "string",
2549 "options": [{"value": "enable"}, {"value": "disable"}],
2550 },
2551 "consolidated_firewall_mode": {
2552 "v_range": [["v6.2.0", "v6.2.7"]],
2553 "type": "string",
2554 "options": [{"value": "enable"}, {"value": "disable"}],
2555 },
2556 "gui_per_policy_disclaimer": {
2557 "v_range": [["v6.2.0", "v6.2.7"]],
2558 "type": "string",
2559 "options": [{"value": "enable"}, {"value": "disable"}],
2560 },
2561 "inspection_mode": {
2562 "v_range": [["v6.0.0", "v6.0.11"]],
2563 "type": "string",
2564 "options": [{"value": "proxy"}, {"value": "flow"}],
2565 },
2566 "ssl_ssh_profile": {"v_range": [["v6.0.0", "v6.0.11"]], "type": "string"},
2567 "sip_helper": {
2568 "v_range": [["v6.0.0", "v6.0.11"]],
2569 "type": "string",
2570 "options": [{"value": "enable"}, {"value": "disable"}],
2571 },
2572 "gui_dlp": {
2573 "v_range": [["v6.0.0", "v6.0.11"]],
2574 "type": "string",
2575 "options": [{"value": "enable"}, {"value": "disable"}],
2576 },
2577 "gui_policy_learning": {
2578 "v_range": [["v6.0.0", "v6.0.11"]],
2579 "type": "string",
2580 "options": [{"value": "enable"}, {"value": "disable"}],
2581 },
2582 "compliance_check": {
2583 "v_range": [["v6.0.0", "v6.0.11"]],
2584 "type": "string",
2585 "options": [{"value": "enable"}, {"value": "disable"}],
2586 },
2587 },
2588 }
2589
2590
2591 def main():
2592 module_spec = schema_to_module_spec(versioned_schema)
2593 mkeyname = None
2594 fields = {
2595 "access_token": {"required": False, "type": "str", "no_log": True},
2596 "enable_log": {"required": False, "type": "bool", "default": False},
2597 "vdom": {"required": False, "type": "str", "default": "root"},
2598 "member_path": {"required": False, "type": "str"},
2599 "member_state": {
2600 "type": "str",
2601 "required": False,
2602 "choices": ["present", "absent"],
2603 },
2604 "system_settings": {
2605 "required": False,
2606 "type": "dict",
2607 "default": None,
2608 "options": {},
2609 },
2610 }
2611 for attribute_name in module_spec["options"]:
2612 fields["system_settings"]["options"][attribute_name] = module_spec["options"][
2613 attribute_name
2614 ]
2615 if mkeyname and mkeyname == attribute_name:
2616 fields["system_settings"]["options"][attribute_name]["required"] = True
2617
2618 module = AnsibleModule(argument_spec=fields, supports_check_mode=True)
2619 check_legacy_fortiosapi(module)
2620
2621 is_error = False
2622 has_changed = False
2623 result = None
2624 diff = None
2625
2626 versions_check_result = None
2627 if module._socket_path:
2628 connection = Connection(module._socket_path)
2629 if "access_token" in module.params:
2630 connection.set_custom_option("access_token", module.params["access_token"])
2631
2632 if "enable_log" in module.params:
2633 connection.set_custom_option("enable_log", module.params["enable_log"])
2634 else:
2635 connection.set_custom_option("enable_log", False)
2636 fos = FortiOSHandler(connection, module, mkeyname, admin_passwd_header=False)
2637 versions_check_result = check_schema_versioning(
2638 fos, versioned_schema, "system_settings"
2639 )
2640
2641 is_error, has_changed, result, diff = fortios_system(
2642 module.params, fos, module.check_mode
2643 )
2644
2645 else:
2646 module.fail_json(**FAIL_SOCKET_MSG)
2647
2648 if versions_check_result and versions_check_result["matched"] is False:
2649 module.warn(
2650 "Ansible has detected version mismatch between FortOS system and your playbook, see more details by specifying option -vvv"
2651 )
2652
2653 if not is_error:
2654 if versions_check_result and versions_check_result["matched"] is False:
2655 module.exit_json(
2656 changed=has_changed,
2657 version_check_warning=versions_check_result,
2658 meta=result,
2659 diff=diff,
2660 )
2661 else:
2662 module.exit_json(changed=has_changed, meta=result, diff=diff)
2663 else:
2664 if versions_check_result and versions_check_result["matched"] is False:
2665 module.fail_json(
2666 msg="Error in repo",
2667 version_check_warning=versions_check_result,
2668 meta=result,
2669 )
2670 else:
2671 module.fail_json(msg="Error in repo", meta=result)
2672
2673
2674 if __name__ == "__main__":
2675 main()