Debian Codegraph @

ansible_collections/fortinet/fortios/plugins/modules/fortios_firewall_vip.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_firewall_vip
23 short_description: Configure virtual IP for IPv4 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 firewall feature and vip 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 state:
80 description:
81 - Indicates whether to create or remove the object.
82 type: str
83 required: true
84 choices:
85 - 'present'
86 - 'absent'
87 firewall_vip:
88 description:
89 - Configure virtual IP for IPv4.
90 default: null
91 type: dict
92 suboptions:
93 add_nat46_route:
94 description:
95 - Enable/disable adding NAT46 route.
96 type: str
97 choices:
98 - 'disable'
99 - 'enable'
100 arp_reply:
101 description:
102 - Enable to respond to ARP requests for this virtual IP address. Enabled by default.
103 type: str
104 choices:
105 - 'disable'
106 - 'enable'
107 client_cert:
108 description:
109 - Enable/disable requesting client certificate.
110 type: str
111 choices:
112 - 'disable'
113 - 'enable'
114 color:
115 description:
116 - Color of icon on the GUI.
117 type: int
118 comment:
119 description:
120 - Comment.
121 type: str
122 dns_mapping_ttl:
123 description:
124 - DNS mapping TTL (Set to zero to use TTL in DNS response).
125 type: int
126 empty_cert_action:
127 description:
128 - Action for an empty client certificate.
129 type: str
130 choices:
131 - 'accept'
132 - 'block'
133 - 'accept-unmanageable'
134 extaddr:
135 description:
136 - External FQDN address name.
137 type: list
138 elements: dict
139 suboptions:
140 name:
141 description:
142 - Address name. Source firewall.address.name firewall.addrgrp.name.
143 required: true
144 type: str
145 extintf:
146 description:
147 - Interface connected to the source network that receives the packets that will be forwarded to the destination network. Source system
148 .interface.name.
149 type: str
150 extip:
151 description:
152 - IP address or address range on the external interface that you want to map to an address or address range on the destination network.
153 type: str
154 extport:
155 description:
156 - Incoming port number range that you want to map to a port number range on the destination network.
157 type: str
158 gratuitous_arp_interval:
159 description:
160 - Enable to have the VIP send gratuitous ARPs. 0=disabled. Set from 5 up to 8640000 seconds to enable.
161 type: int
162 gslb_domain_name:
163 description:
164 - Domain to use when integrating with FortiGSLB.
165 type: str
166 gslb_hostname:
167 description:
168 - Hostname to use within the configured FortiGSLB domain.
169 type: str
170 gslb_public_ips:
171 description:
172 - Publicly accessible IP addresses for the FortiGSLB service.
173 type: list
174 elements: dict
175 suboptions:
176 index:
177 description:
178 - Index of this public IP setting. see <a href='#notes'>Notes</a>.
179 required: true
180 type: int
181 ip:
182 description:
183 - The publicly accessible IP address.
184 type: str
185 h2_support:
186 description:
187 - Enable/disable HTTP2 support .
188 type: str
189 choices:
190 - 'enable'
191 - 'disable'
192 h3_support:
193 description:
194 - Enable/disable HTTP3/QUIC support .
195 type: str
196 choices:
197 - 'enable'
198 - 'disable'
199 http_cookie_age:
200 description:
201 - Time in minutes that client web browsers should keep a cookie. Default is 60 minutes. 0 = no time limit.
202 type: int
203 http_cookie_domain:
204 description:
205 - Domain that HTTP cookie persistence should apply to.
206 type: str
207 http_cookie_domain_from_host:
208 description:
209 - Enable/disable use of HTTP cookie domain from host field in HTTP.
210 type: str
211 choices:
212 - 'disable'
213 - 'enable'
214 http_cookie_generation:
215 description:
216 - Generation of HTTP cookie to be accepted. Changing invalidates all existing cookies.
217 type: int
218 http_cookie_path:
219 description:
220 - Limit HTTP cookie persistence to the specified path.
221 type: str
222 http_cookie_share:
223 description:
224 - Control sharing of cookies across virtual servers. Use of same-ip means a cookie from one virtual server can be used by another. Disable
225 stops cookie sharing.
226 type: str
227 choices:
228 - 'disable'
229 - 'same-ip'
230 http_ip_header:
231 description:
232 - For HTTP multiplexing, enable to add the original client IP address in the X-Forwarded-For HTTP header.
233 type: str
234 choices:
235 - 'enable'
236 - 'disable'
237 http_ip_header_name:
238 description:
239 - For HTTP multiplexing, enter a custom HTTPS header name. The original client IP address is added to this header. If empty,
240 X-Forwarded-For is used.
241 type: str
242 http_multiplex:
243 description:
244 - Enable/disable HTTP multiplexing.
245 type: str
246 choices:
247 - 'enable'
248 - 'disable'
249 http_multiplex_max_concurrent_request:
250 description:
251 - Maximum number of concurrent requests that a multiplex server can handle .
252 type: int
253 http_multiplex_max_request:
254 description:
255 - Maximum number of requests that a multiplex server can handle before disconnecting sessions .
256 type: int
257 http_multiplex_ttl:
258 description:
259 - Time-to-live for idle connections to servers.
260 type: int
261 http_redirect:
262 description:
263 - Enable/disable redirection of HTTP to HTTPS.
264 type: str
265 choices:
266 - 'enable'
267 - 'disable'
268 http_supported_max_version:
269 description:
270 - Maximum supported HTTP versions. default = HTTP2
271 type: str
272 choices:
273 - 'http1'
274 - 'http2'
275 https_cookie_secure:
276 description:
277 - Enable/disable verification that inserted HTTPS cookies are secure.
278 type: str
279 choices:
280 - 'disable'
281 - 'enable'
282 id:
283 description:
284 - Custom defined ID.
285 type: int
286 ipv6_mappedip:
287 description:
288 - Range of mapped IPv6 addresses. Specify the start IPv6 address followed by a space and the end IPv6 address.
289 type: str
290 ipv6_mappedport:
291 description:
292 - IPv6 port number range on the destination network to which the external port number range is mapped.
293 type: str
294 ldb_method:
295 description:
296 - Method used to distribute sessions to real servers.
297 type: str
298 choices:
299 - 'static'
300 - 'round-robin'
301 - 'weighted'
302 - 'least-session'
303 - 'least-rtt'
304 - 'first-alive'
305 - 'http-host'
306 mapped_addr:
307 description:
308 - Mapped FQDN address name. Source firewall.address.name.
309 type: str
310 mappedip:
311 description:
312 - IP address or address range on the destination network to which the external IP address is mapped.
313 type: list
314 elements: dict
315 suboptions:
316 range:
317 description:
318 - Mapped IP range.
319 required: true
320 type: str
321 mappedport:
322 description:
323 - Port number range on the destination network to which the external port number range is mapped.
324 type: str
325 max_embryonic_connections:
326 description:
327 - Maximum number of incomplete connections.
328 type: int
329 monitor:
330 description:
331 - Name of the health check monitor to use when polling to determine a virtual server"s connectivity status.
332 type: list
333 elements: dict
334 suboptions:
335 name:
336 description:
337 - Health monitor name. Source firewall.ldb-monitor.name.
338 required: true
339 type: str
340 name:
341 description:
342 - Virtual IP name.
343 required: true
344 type: str
345 nat_source_vip:
346 description:
347 - Enable/disable forcing the source NAT mapped IP to the external IP for all traffic.
348 type: str
349 choices:
350 - 'disable'
351 - 'enable'
352 nat44:
353 description:
354 - Enable/disable NAT44.
355 type: str
356 choices:
357 - 'disable'
358 - 'enable'
359 nat46:
360 description:
361 - Enable/disable NAT46.
362 type: str
363 choices:
364 - 'disable'
365 - 'enable'
366 one_click_gslb_server:
367 description:
368 - Enable/disable one click GSLB server integration with FortiGSLB.
369 type: str
370 choices:
371 - 'disable'
372 - 'enable'
373 outlook_web_access:
374 description:
375 - Enable to add the Front-End-Https header for Microsoft Outlook Web Access.
376 type: str
377 choices:
378 - 'disable'
379 - 'enable'
380 persistence:
381 description:
382 - Configure how to make sure that clients connect to the same server every time they make a request that is part of the same session.
383 type: str
384 choices:
385 - 'none'
386 - 'http-cookie'
387 - 'ssl-session-id'
388 portforward:
389 description:
390 - Enable/disable port forwarding.
391 type: str
392 choices:
393 - 'disable'
394 - 'enable'
395 portmapping_type:
396 description:
397 - Port mapping type.
398 type: str
399 choices:
400 - '1-to-1'
401 - 'm-to-n'
402 protocol:
403 description:
404 - Protocol to use when forwarding packets.
405 type: str
406 choices:
407 - 'tcp'
408 - 'udp'
409 - 'sctp'
410 - 'icmp'
411 quic:
412 description:
413 - QUIC setting.
414 type: dict
415 suboptions:
416 ack_delay_exponent:
417 description:
418 - ACK delay exponent (1 - 20).
419 type: int
420 active_connection_id_limit:
421 description:
422 - Active connection ID limit (1 - 8).
423 type: int
424 active_migration:
425 description:
426 - Enable/disable active migration .
427 type: str
428 choices:
429 - 'enable'
430 - 'disable'
431 grease_quic_bit:
432 description:
433 - Enable/disable grease QUIC bit .
434 type: str
435 choices:
436 - 'enable'
437 - 'disable'
438 max_ack_delay:
439 description:
440 - Maximum ACK delay in milliseconds (1 - 16383).
441 type: int
442 max_datagram_frame_size:
443 description:
444 - Maximum datagram frame size in bytes (1 - 1500).
445 type: int
446 max_idle_timeout:
447 description:
448 - Maximum idle timeout milliseconds (1 - 60000).
449 type: int
450 max_udp_payload_size:
451 description:
452 - Maximum UDP payload size in bytes (1200 - 1500).
453 type: int
454 realservers:
455 description:
456 - Select the real servers that this server load balancing VIP will distribute traffic to.
457 type: list
458 elements: dict
459 suboptions:
460 address:
461 description:
462 - Dynamic address of the real server. Source firewall.address.name.
463 type: str
464 client_ip:
465 description:
466 - Only clients in this IP range can connect to this real server.
467 type: str
468 healthcheck:
469 description:
470 - Enable to check the responsiveness of the real server before forwarding traffic.
471 type: str
472 choices:
473 - 'disable'
474 - 'enable'
475 - 'vip'
476 holddown_interval:
477 description:
478 - Time in seconds that the system waits before re-activating a previously down active server in the active-standby mode. This is
479 to prevent any flapping issues.
480 type: int
481 http_host:
482 description:
483 - HTTP server domain name in HTTP header.
484 type: str
485 id:
486 description:
487 - Real server ID. see <a href='#notes'>Notes</a>.
488 required: true
489 type: int
490 ip:
491 description:
492 - IP address of the real server.
493 type: str
494 max_connections:
495 description:
496 - Max number of active connections that can be directed to the real server. When reached, sessions are sent to other real servers.
497 type: int
498 monitor:
499 description:
500 - Name of the health check monitor to use when polling to determine a virtual server"s connectivity status. Source firewall
501 .ldb-monitor.name.
502 type: list
503 elements: dict
504 suboptions:
505 name:
506 description:
507 - Health monitor name. Source firewall.ldb-monitor.name.
508 required: true
509 type: str
510 port:
511 description:
512 - Port for communicating with the real server. Required if port forwarding is enabled.
513 type: int
514 status:
515 description:
516 - Set the status of the real server to active so that it can accept traffic, or on standby or disabled so no traffic is sent.
517 type: str
518 choices:
519 - 'active'
520 - 'standby'
521 - 'disable'
522 translate_host:
523 description:
524 - Enable/disable translation of hostname/IP from virtual server to real server.
525 type: str
526 choices:
527 - 'enable'
528 - 'disable'
529 type:
530 description:
531 - Type of address.
532 type: str
533 choices:
534 - 'ip'
535 - 'address'
536 verify_cert:
537 description:
538 - Enable/disable certificate verification of the real server.
539 type: str
540 choices:
541 - 'enable'
542 - 'disable'
543 weight:
544 description:
545 - Weight of the real server. If weighted load balancing is enabled, the server with the highest weight gets more connections.
546 type: int
547 server_type:
548 description:
549 - Protocol to be load balanced by the virtual server (also called the server load balance virtual IP).
550 type: str
551 choices:
552 - 'http'
553 - 'https'
554 - 'imaps'
555 - 'pop3s'
556 - 'smtps'
557 - 'ssl'
558 - 'tcp'
559 - 'udp'
560 - 'ip'
561 - 'ssh'
562 service:
563 description:
564 - Service name.
565 type: list
566 elements: dict
567 suboptions:
568 name:
569 description:
570 - Service name. Source firewall.service.custom.name firewall.service.group.name.
571 required: true
572 type: str
573 src_filter:
574 description:
575 - Source address filter. Each address must be either an IP/subnet (x.x.x.x/n) or a range (x.x.x.x-y.y.y.y). Separate addresses with spaces.
576 type: list
577 elements: dict
578 suboptions:
579 range:
580 description:
581 - Source-filter range.
582 required: true
583 type: str
584 src_vip_filter:
585 description:
586 - Enable/disable use of "src-filter" to match destinations for the reverse SNAT rule.
587 type: str
588 choices:
589 - 'disable'
590 - 'enable'
591 srcintf_filter:
592 description:
593 - Interfaces to which the VIP applies. Separate the names with spaces.
594 type: list
595 elements: dict
596 suboptions:
597 interface_name:
598 description:
599 - Interface name. Source system.interface.name.
600 required: true
601 type: str
602 ssl_accept_ffdhe_groups:
603 description:
604 - Enable/disable FFDHE cipher suite for SSL key exchange.
605 type: str
606 choices:
607 - 'enable'
608 - 'disable'
609 ssl_algorithm:
610 description:
611 - Permitted encryption algorithms for SSL sessions according to encryption strength.
612 type: str
613 choices:
614 - 'high'
615 - 'medium'
616 - 'low'
617 - 'custom'
618 ssl_certificate:
619 description:
620 - The name of the certificate to use for SSL handshake. Source vpn.certificate.local.name.
621 type: str
622 ssl_certificate_dict:
623 description:
624 - Name of the certificate to use for SSL handshake.
625 type: list
626 elements: dict
627 suboptions:
628 name:
629 description:
630 - Certificate list. Source vpn.certificate.local.name.
631 required: true
632 type: str
633 ssl_cipher_suites:
634 description:
635 - SSL/TLS cipher suites acceptable from a client, ordered by priority.
636 type: list
637 elements: dict
638 suboptions:
639 cipher:
640 description:
641 - Cipher suite name.
642 type: str
643 choices:
644 - 'TLS-AES-128-GCM-SHA256'
645 - 'TLS-AES-256-GCM-SHA384'
646 - 'TLS-CHACHA20-POLY1305-SHA256'
647 - 'TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256'
648 - 'TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256'
649 - 'TLS-DHE-RSA-WITH-CHACHA20-POLY1305-SHA256'
650 - 'TLS-DHE-RSA-WITH-AES-128-CBC-SHA'
651 - 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA'
652 - 'TLS-DHE-RSA-WITH-AES-128-CBC-SHA256'
653 - 'TLS-DHE-RSA-WITH-AES-128-GCM-SHA256'
654 - 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA256'
655 - 'TLS-DHE-RSA-WITH-AES-256-GCM-SHA384'
656 - 'TLS-DHE-DSS-WITH-AES-128-CBC-SHA'
657 - 'TLS-DHE-DSS-WITH-AES-256-CBC-SHA'
658 - 'TLS-DHE-DSS-WITH-AES-128-CBC-SHA256'
659 - 'TLS-DHE-DSS-WITH-AES-128-GCM-SHA256'
660 - 'TLS-DHE-DSS-WITH-AES-256-CBC-SHA256'
661 - 'TLS-DHE-DSS-WITH-AES-256-GCM-SHA384'
662 - 'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA'
663 - 'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256'
664 - 'TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256'
665 - 'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA'
666 - 'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384'
667 - 'TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384'
668 - 'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA'
669 - 'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256'
670 - 'TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256'
671 - 'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA'
672 - 'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384'
673 - 'TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384'
674 - 'TLS-RSA-WITH-AES-128-CBC-SHA'
675 - 'TLS-RSA-WITH-AES-256-CBC-SHA'
676 - 'TLS-RSA-WITH-AES-128-CBC-SHA256'
677 - 'TLS-RSA-WITH-AES-128-GCM-SHA256'
678 - 'TLS-RSA-WITH-AES-256-CBC-SHA256'
679 - 'TLS-RSA-WITH-AES-256-GCM-SHA384'
680 - 'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA'
681 - 'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA'
682 - 'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256'
683 - 'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256'
684 - 'TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA'
685 - 'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA'
686 - 'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA'
687 - 'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA'
688 - 'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA'
689 - 'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256'
690 - 'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA256'
691 - 'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256'
692 - 'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA256'
693 - 'TLS-DHE-RSA-WITH-SEED-CBC-SHA'
694 - 'TLS-DHE-DSS-WITH-SEED-CBC-SHA'
695 - 'TLS-DHE-RSA-WITH-ARIA-128-CBC-SHA256'
696 - 'TLS-DHE-RSA-WITH-ARIA-256-CBC-SHA384'
697 - 'TLS-DHE-DSS-WITH-ARIA-128-CBC-SHA256'
698 - 'TLS-DHE-DSS-WITH-ARIA-256-CBC-SHA384'
699 - 'TLS-RSA-WITH-SEED-CBC-SHA'
700 - 'TLS-RSA-WITH-ARIA-128-CBC-SHA256'
701 - 'TLS-RSA-WITH-ARIA-256-CBC-SHA384'
702 - 'TLS-ECDHE-RSA-WITH-ARIA-128-CBC-SHA256'
703 - 'TLS-ECDHE-RSA-WITH-ARIA-256-CBC-SHA384'
704 - 'TLS-ECDHE-ECDSA-WITH-ARIA-128-CBC-SHA256'
705 - 'TLS-ECDHE-ECDSA-WITH-ARIA-256-CBC-SHA384'
706 - 'TLS-ECDHE-RSA-WITH-RC4-128-SHA'
707 - 'TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA'
708 - 'TLS-DHE-DSS-WITH-3DES-EDE-CBC-SHA'
709 - 'TLS-RSA-WITH-3DES-EDE-CBC-SHA'
710 - 'TLS-RSA-WITH-RC4-128-MD5'
711 - 'TLS-RSA-WITH-RC4-128-SHA'
712 - 'TLS-DHE-RSA-WITH-DES-CBC-SHA'
713 - 'TLS-DHE-DSS-WITH-DES-CBC-SHA'
714 - 'TLS-RSA-WITH-DES-CBC-SHA'
715 priority:
716 description:
717 - SSL/TLS cipher suites priority. see <a href='#notes'>Notes</a>.
718 required: true
719 type: int
720 versions:
721 description:
722 - SSL/TLS versions that the cipher suite can be used with.
723 type: list
724 elements: str
725 choices:
726 - 'ssl-3.0'
727 - 'tls-1.0'
728 - 'tls-1.1'
729 - 'tls-1.2'
730 - 'tls-1.3'
731 ssl_client_fallback:
732 description:
733 - Enable/disable support for preventing Downgrade Attacks on client connections (RFC 7507).
734 type: str
735 choices:
736 - 'disable'
737 - 'enable'
738 ssl_client_rekey_count:
739 description:
740 - Maximum length of data in MB before triggering a client rekey (0 = disable).
741 type: int
742 ssl_client_renegotiation:
743 description:
744 - Allow, deny, or require secure renegotiation of client sessions to comply with RFC 5746.
745 type: str
746 choices:
747 - 'allow'
748 - 'deny'
749 - 'secure'
750 ssl_client_session_state_max:
751 description:
752 - Maximum number of client to FortiGate SSL session states to keep.
753 type: int
754 ssl_client_session_state_timeout:
755 description:
756 - Number of minutes to keep client to FortiGate SSL session state.
757 type: int
758 ssl_client_session_state_type:
759 description:
760 - How to expire SSL sessions for the segment of the SSL connection between the client and the FortiGate.
761 type: str
762 choices:
763 - 'disable'
764 - 'time'
765 - 'count'
766 - 'both'
767 ssl_dh_bits:
768 description:
769 - Number of bits to use in the Diffie-Hellman exchange for RSA encryption of SSL sessions.
770 type: str
771 choices:
772 - '768'
773 - '1024'
774 - '1536'
775 - '2048'
776 - '3072'
777 - '4096'
778 ssl_hpkp:
779 description:
780 - Enable/disable including HPKP header in response.
781 type: str
782 choices:
783 - 'disable'
784 - 'enable'
785 - 'report-only'
786 ssl_hpkp_age:
787 description:
788 - Number of seconds the client should honor the HPKP setting.
789 type: int
790 ssl_hpkp_backup:
791 description:
792 - Certificate to generate backup HPKP pin from. Source vpn.certificate.local.name vpn.certificate.ca.name.
793 type: str
794 ssl_hpkp_include_subdomains:
795 description:
796 - Indicate that HPKP header applies to all subdomains.
797 type: str
798 choices:
799 - 'disable'
800 - 'enable'
801 ssl_hpkp_primary:
802 description:
803 - Certificate to generate primary HPKP pin from. Source vpn.certificate.local.name vpn.certificate.ca.name.
804 type: str
805 ssl_hpkp_report_uri:
806 description:
807 - URL to report HPKP violations to.
808 type: str
809 ssl_hsts:
810 description:
811 - Enable/disable including HSTS header in response.
812 type: str
813 choices:
814 - 'disable'
815 - 'enable'
816 ssl_hsts_age:
817 description:
818 - Number of seconds the client should honor the HSTS setting.
819 type: int
820 ssl_hsts_include_subdomains:
821 description:
822 - Indicate that HSTS header applies to all subdomains.
823 type: str
824 choices:
825 - 'disable'
826 - 'enable'
827 ssl_http_location_conversion:
828 description:
829 - Enable to replace HTTP with HTTPS in the reply"s Location HTTP header field.
830 type: str
831 choices:
832 - 'enable'
833 - 'disable'
834 ssl_http_match_host:
835 description:
836 - Enable/disable HTTP host matching for location conversion.
837 type: str
838 choices:
839 - 'enable'
840 - 'disable'
841 ssl_max_version:
842 description:
843 - Highest SSL/TLS version acceptable from a client.
844 type: str
845 choices:
846 - 'ssl-3.0'
847 - 'tls-1.0'
848 - 'tls-1.1'
849 - 'tls-1.2'
850 - 'tls-1.3'
851 ssl_min_version:
852 description:
853 - Lowest SSL/TLS version acceptable from a client.
854 type: str
855 choices:
856 - 'ssl-3.0'
857 - 'tls-1.0'
858 - 'tls-1.1'
859 - 'tls-1.2'
860 - 'tls-1.3'
861 ssl_mode:
862 description:
863 - Apply SSL offloading between the client and the FortiGate (half) or from the client to the FortiGate and from the FortiGate to the
864 server (full).
865 type: str
866 choices:
867 - 'half'
868 - 'full'
869 ssl_pfs:
870 description:
871 - Select the cipher suites that can be used for SSL perfect forward secrecy (PFS). Applies to both client and server sessions.
872 type: str
873 choices:
874 - 'require'
875 - 'deny'
876 - 'allow'
877 ssl_send_empty_frags:
878 description:
879 - Enable/disable sending empty fragments to avoid CBC IV attacks (SSL 3.0 & TLS 1.0 only). May need to be disabled for compatibility with
880 older systems.
881 type: str
882 choices:
883 - 'enable'
884 - 'disable'
885 ssl_server_algorithm:
886 description:
887 - Permitted encryption algorithms for the server side of SSL full mode sessions according to encryption strength.
888 type: str
889 choices:
890 - 'high'
891 - 'medium'
892 - 'low'
893 - 'custom'
894 - 'client'
895 ssl_server_cipher_suites:
896 description:
897 - SSL/TLS cipher suites to offer to a server, ordered by priority.
898 type: list
899 elements: dict
900 suboptions:
901 cipher:
902 description:
903 - Cipher suite name.
904 type: str
905 choices:
906 - 'TLS-AES-128-GCM-SHA256'
907 - 'TLS-AES-256-GCM-SHA384'
908 - 'TLS-CHACHA20-POLY1305-SHA256'
909 - 'TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256'
910 - 'TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256'
911 - 'TLS-DHE-RSA-WITH-CHACHA20-POLY1305-SHA256'
912 - 'TLS-DHE-RSA-WITH-AES-128-CBC-SHA'
913 - 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA'
914 - 'TLS-DHE-RSA-WITH-AES-128-CBC-SHA256'
915 - 'TLS-DHE-RSA-WITH-AES-128-GCM-SHA256'
916 - 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA256'
917 - 'TLS-DHE-RSA-WITH-AES-256-GCM-SHA384'
918 - 'TLS-DHE-DSS-WITH-AES-128-CBC-SHA'
919 - 'TLS-DHE-DSS-WITH-AES-256-CBC-SHA'
920 - 'TLS-DHE-DSS-WITH-AES-128-CBC-SHA256'
921 - 'TLS-DHE-DSS-WITH-AES-128-GCM-SHA256'
922 - 'TLS-DHE-DSS-WITH-AES-256-CBC-SHA256'
923 - 'TLS-DHE-DSS-WITH-AES-256-GCM-SHA384'
924 - 'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA'
925 - 'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256'
926 - 'TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256'
927 - 'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA'
928 - 'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384'
929 - 'TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384'
930 - 'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA'
931 - 'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256'
932 - 'TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256'
933 - 'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA'
934 - 'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384'
935 - 'TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384'
936 - 'TLS-RSA-WITH-AES-128-CBC-SHA'
937 - 'TLS-RSA-WITH-AES-256-CBC-SHA'
938 - 'TLS-RSA-WITH-AES-128-CBC-SHA256'
939 - 'TLS-RSA-WITH-AES-128-GCM-SHA256'
940 - 'TLS-RSA-WITH-AES-256-CBC-SHA256'
941 - 'TLS-RSA-WITH-AES-256-GCM-SHA384'
942 - 'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA'
943 - 'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA'
944 - 'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256'
945 - 'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256'
946 - 'TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA'
947 - 'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA'
948 - 'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA'
949 - 'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA'
950 - 'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA'
951 - 'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256'
952 - 'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA256'
953 - 'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256'
954 - 'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA256'
955 - 'TLS-DHE-RSA-WITH-SEED-CBC-SHA'
956 - 'TLS-DHE-DSS-WITH-SEED-CBC-SHA'
957 - 'TLS-DHE-RSA-WITH-ARIA-128-CBC-SHA256'
958 - 'TLS-DHE-RSA-WITH-ARIA-256-CBC-SHA384'
959 - 'TLS-DHE-DSS-WITH-ARIA-128-CBC-SHA256'
960 - 'TLS-DHE-DSS-WITH-ARIA-256-CBC-SHA384'
961 - 'TLS-RSA-WITH-SEED-CBC-SHA'
962 - 'TLS-RSA-WITH-ARIA-128-CBC-SHA256'
963 - 'TLS-RSA-WITH-ARIA-256-CBC-SHA384'
964 - 'TLS-ECDHE-RSA-WITH-ARIA-128-CBC-SHA256'
965 - 'TLS-ECDHE-RSA-WITH-ARIA-256-CBC-SHA384'
966 - 'TLS-ECDHE-ECDSA-WITH-ARIA-128-CBC-SHA256'
967 - 'TLS-ECDHE-ECDSA-WITH-ARIA-256-CBC-SHA384'
968 - 'TLS-ECDHE-RSA-WITH-RC4-128-SHA'
969 - 'TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA'
970 - 'TLS-DHE-DSS-WITH-3DES-EDE-CBC-SHA'
971 - 'TLS-RSA-WITH-3DES-EDE-CBC-SHA'
972 - 'TLS-RSA-WITH-RC4-128-MD5'
973 - 'TLS-RSA-WITH-RC4-128-SHA'
974 - 'TLS-DHE-RSA-WITH-DES-CBC-SHA'
975 - 'TLS-DHE-DSS-WITH-DES-CBC-SHA'
976 - 'TLS-RSA-WITH-DES-CBC-SHA'
977 priority:
978 description:
979 - SSL/TLS cipher suites priority. see <a href='#notes'>Notes</a>.
980 required: true
981 type: int
982 versions:
983 description:
984 - SSL/TLS versions that the cipher suite can be used with.
985 type: list
986 elements: str
987 choices:
988 - 'ssl-3.0'
989 - 'tls-1.0'
990 - 'tls-1.1'
991 - 'tls-1.2'
992 - 'tls-1.3'
993 ssl_server_max_version:
994 description:
995 - Highest SSL/TLS version acceptable from a server. Use the client setting by default.
996 type: str
997 choices:
998 - 'ssl-3.0'
999 - 'tls-1.0'
1000 - 'tls-1.1'
1001 - 'tls-1.2'
1002 - 'tls-1.3'
1003 - 'client'
1004 ssl_server_min_version:
1005 description:
1006 - Lowest SSL/TLS version acceptable from a server. Use the client setting by default.
1007 type: str
1008 choices:
1009 - 'ssl-3.0'
1010 - 'tls-1.0'
1011 - 'tls-1.1'
1012 - 'tls-1.2'
1013 - 'tls-1.3'
1014 - 'client'
1015 ssl_server_renegotiation:
1016 description:
1017 - Enable/disable secure renegotiation to comply with RFC 5746.
1018 type: str
1019 choices:
1020 - 'enable'
1021 - 'disable'
1022 ssl_server_session_state_max:
1023 description:
1024 - Maximum number of FortiGate to Server SSL session states to keep.
1025 type: int
1026 ssl_server_session_state_timeout:
1027 description:
1028 - Number of minutes to keep FortiGate to Server SSL session state.
1029 type: int
1030 ssl_server_session_state_type:
1031 description:
1032 - How to expire SSL sessions for the segment of the SSL connection between the server and the FortiGate.
1033 type: str
1034 choices:
1035 - 'disable'
1036 - 'time'
1037 - 'count'
1038 - 'both'
1039 status:
1040 description:
1041 - Enable/disable VIP.
1042 type: str
1043 choices:
1044 - 'disable'
1045 - 'enable'
1046 type:
1047 description:
1048 - Configure a static NAT, load balance, server load balance, access proxy, DNS translation, or FQDN VIP.
1049 type: str
1050 choices:
1051 - 'static-nat'
1052 - 'load-balance'
1053 - 'server-load-balance'
1054 - 'dns-translation'
1055 - 'fqdn'
1056 - 'access-proxy'
1057 user_agent_detect:
1058 description:
1059 - Enable/disable detecting device type by HTTP user-agent if no client certificate is provided.
1060 type: str
1061 choices:
1062 - 'disable'
1063 - 'enable'
1064 uuid:
1065 description:
1066 - Universally Unique Identifier (UUID; automatically assigned but can be manually reset).
1067 type: str
1068 weblogic_server:
1069 description:
1070 - Enable to add an HTTP header to indicate SSL offloading for a WebLogic server.
1071 type: str
1072 choices:
1073 - 'disable'
1074 - 'enable'
1075 websphere_server:
1076 description:
1077 - Enable to add an HTTP header to indicate SSL offloading for a WebSphere server.
1078 type: str
1079 choices:
1080 - 'disable'
1081 - 'enable'
1082 """
1083
1084 EXAMPLES = """
1085 - name: Configure virtual IP for IPv4.
1086 fortinet.fortios.fortios_firewall_vip:
1087 vdom: "{{ vdom }}"
1088 state: "present"
1089 access_token: "<your_own_value>"
1090 firewall_vip:
1091 add_nat46_route: "disable"
1092 arp_reply: "disable"
1093 client_cert: "disable"
1094 color: "0"
1095 comment: "Comment."
1096 dns_mapping_ttl: "0"
1097 empty_cert_action: "accept"
1098 extaddr:
1099 -
1100 name: "default_name_11 (source firewall.address.name firewall.addrgrp.name)"
1101 extintf: "<your_own_value> (source system.interface.name)"
1102 extip: "<your_own_value>"
1103 extport: "<your_own_value>"
1104 gratuitous_arp_interval: "0"
1105 gslb_domain_name: "<your_own_value>"
1106 gslb_hostname: "myhostname"
1107 gslb_public_ips:
1108 -
1109 index: "<you_own_value>"
1110 ip: "<your_own_value>"
1111 h2_support: "enable"
1112 h3_support: "enable"
1113 http_cookie_age: "60"
1114 http_cookie_domain: "<your_own_value>"
1115 http_cookie_domain_from_host: "disable"
1116 http_cookie_generation: "0"
1117 http_cookie_path: "<your_own_value>"
1118 http_cookie_share: "disable"
1119 http_ip_header: "enable"
1120 http_ip_header_name: "<your_own_value>"
1121 http_multiplex: "enable"
1122 http_multiplex_max_concurrent_request: "0"
1123 http_multiplex_max_request: "0"
1124 http_multiplex_ttl: "15"
1125 http_redirect: "enable"
1126 http_supported_max_version: "http1"
1127 https_cookie_secure: "disable"
1128 id: "38"
1129 ipv6_mappedip: "<your_own_value>"
1130 ipv6_mappedport: "<your_own_value>"
1131 ldb_method: "static"
1132 mapped_addr: "<your_own_value> (source firewall.address.name)"
1133 mappedip:
1134 -
1135 range: "<your_own_value>"
1136 mappedport: "<your_own_value>"
1137 max_embryonic_connections: "1000"
1138 monitor:
1139 -
1140 name: "default_name_48 (source firewall.ldb-monitor.name)"
1141 name: "default_name_49"
1142 nat_source_vip: "disable"
1143 nat44: "disable"
1144 nat46: "disable"
1145 one_click_gslb_server: "disable"
1146 outlook_web_access: "disable"
1147 persistence: "none"
1148 portforward: "disable"
1149 portmapping_type: "1-to-1"
1150 protocol: "tcp"
1151 quic:
1152 ack_delay_exponent: "3"
1153 active_connection_id_limit: "2"
1154 active_migration: "enable"
1155 grease_quic_bit: "enable"
1156 max_ack_delay: "25"
1157 max_datagram_frame_size: "1500"
1158 max_idle_timeout: "30000"
1159 max_udp_payload_size: "1500"
1160 realservers:
1161 -
1162 address: "<your_own_value> (source firewall.address.name)"
1163 client_ip: "<your_own_value>"
1164 healthcheck: "disable"
1165 holddown_interval: "300"
1166 http_host: "myhostname"
1167 id: "74"
1168 ip: "<your_own_value>"
1169 max_connections: "0"
1170 monitor:
1171 -
1172 name: "default_name_78 (source firewall.ldb-monitor.name)"
1173 port: "0"
1174 status: "active"
1175 translate_host: "enable"
1176 type: "ip"
1177 verify_cert: "enable"
1178 weight: "1"
1179 server_type: "http"
1180 service:
1181 -
1182 name: "default_name_87 (source firewall.service.custom.name firewall.service.group.name)"
1183 src_filter:
1184 -
1185 range: "<your_own_value>"
1186 src_vip_filter: "disable"
1187 srcintf_filter:
1188 -
1189 interface_name: "<your_own_value> (source system.interface.name)"
1190 ssl_accept_ffdhe_groups: "enable"
1191 ssl_algorithm: "high"
1192 ssl_certificate: "<your_own_value> (source vpn.certificate.local.name)"
1193 ssl_certificate_dict:
1194 -
1195 name: "default_name_97 (source vpn.certificate.local.name)"
1196 ssl_cipher_suites:
1197 -
1198 cipher: "TLS-AES-128-GCM-SHA256"
1199 priority: "<you_own_value>"
1200 versions: "ssl-3.0"
1201 ssl_client_fallback: "disable"
1202 ssl_client_rekey_count: "0"
1203 ssl_client_renegotiation: "allow"
1204 ssl_client_session_state_max: "1000"
1205 ssl_client_session_state_timeout: "30"
1206 ssl_client_session_state_type: "disable"
1207 ssl_dh_bits: "768"
1208 ssl_hpkp: "disable"
1209 ssl_hpkp_age: "5184000"
1210 ssl_hpkp_backup: "<your_own_value> (source vpn.certificate.local.name vpn.certificate.ca.name)"
1211 ssl_hpkp_include_subdomains: "disable"
1212 ssl_hpkp_primary: "<your_own_value> (source vpn.certificate.local.name vpn.certificate.ca.name)"
1213 ssl_hpkp_report_uri: "<your_own_value>"
1214 ssl_hsts: "disable"
1215 ssl_hsts_age: "5184000"
1216 ssl_hsts_include_subdomains: "disable"
1217 ssl_http_location_conversion: "enable"
1218 ssl_http_match_host: "enable"
1219 ssl_max_version: "ssl-3.0"
1220 ssl_min_version: "ssl-3.0"
1221 ssl_mode: "half"
1222 ssl_pfs: "require"
1223 ssl_send_empty_frags: "enable"
1224 ssl_server_algorithm: "high"
1225 ssl_server_cipher_suites:
1226 -
1227 cipher: "TLS-AES-128-GCM-SHA256"
1228 priority: "<you_own_value>"
1229 versions: "ssl-3.0"
1230 ssl_server_max_version: "ssl-3.0"
1231 ssl_server_min_version: "ssl-3.0"
1232 ssl_server_renegotiation: "enable"
1233 ssl_server_session_state_max: "100"
1234 ssl_server_session_state_timeout: "60"
1235 ssl_server_session_state_type: "disable"
1236 status: "disable"
1237 type: "static-nat"
1238 user_agent_detect: "disable"
1239 uuid: "<your_own_value>"
1240 weblogic_server: "disable"
1241 websphere_server: "disable"
1242 """
1243
1244 RETURN = """
1245 build:
1246 description: Build number of the fortigate image
1247 returned: always
1248 type: str
1249 sample: '1547'
1250 http_method:
1251 description: Last method used to provision the content into FortiGate
1252 returned: always
1253 type: str
1254 sample: 'PUT'
1255 http_status:
1256 description: Last result given by FortiGate on last operation applied
1257 returned: always
1258 type: str
1259 sample: "200"
1260 mkey:
1261 description: Master key (id) used in the last call to FortiGate
1262 returned: success
1263 type: str
1264 sample: "id"
1265 name:
1266 description: Name of the table used to fulfill the request
1267 returned: always
1268 type: str
1269 sample: "urlfilter"
1270 path:
1271 description: Path of the table used to fulfill the request
1272 returned: always
1273 type: str
1274 sample: "webfilter"
1275 revision:
1276 description: Internal revision number
1277 returned: always
1278 type: str
1279 sample: "17.0.2.10658"
1280 serial:
1281 description: Serial number of the unit
1282 returned: always
1283 type: str
1284 sample: "FGVMEVYYQT3AB5352"
1285 status:
1286 description: Indication of the operation's result
1287 returned: always
1288 type: str
1289 sample: "success"
1290 vdom:
1291 description: Virtual domain used
1292 returned: always
1293 type: str
1294 sample: "root"
1295 version:
1296 description: Version of the FortiGate
1297 returned: always
1298 type: str
1299 sample: "v5.6.3"
1300 """
1301 from ansible.module_utils.basic import AnsibleModule
1302 from ansible.module_utils.connection import Connection
1303 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1304 FortiOSHandler,
1305 )
1306 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1307 check_legacy_fortiosapi,
1308 )
1309 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1310 schema_to_module_spec,
1311 )
1312 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import (
1313 check_schema_versioning,
1314 )
1315 from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.common import (
1316 FAIL_SOCKET_MSG,
1317 )
1318 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.data_post_processor import (
1319 remove_invalid_fields,
1320 )
1321 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1322 is_same_comparison,
1323 )
1324 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1325 serialize,
1326 )
1327 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1328 find_current_values,
1329 )
1330 from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import (
1331 unify_data_format,
1332 )
1333
1334
1335 def filter_firewall_vip_data(json):
1336 option_list = [
1337 "add_nat46_route",
1338 "arp_reply",
1339 "client_cert",
1340 "color",
1341 "comment",
1342 "dns_mapping_ttl",
1343 "empty_cert_action",
1344 "extaddr",
1345 "extintf",
1346 "extip",
1347 "extport",
1348 "gratuitous_arp_interval",
1349 "gslb_domain_name",
1350 "gslb_hostname",
1351 "gslb_public_ips",
1352 "h2_support",
1353 "h3_support",
1354 "http_cookie_age",
1355 "http_cookie_domain",
1356 "http_cookie_domain_from_host",
1357 "http_cookie_generation",
1358 "http_cookie_path",
1359 "http_cookie_share",
1360 "http_ip_header",
1361 "http_ip_header_name",
1362 "http_multiplex",
1363 "http_multiplex_max_concurrent_request",
1364 "http_multiplex_max_request",
1365 "http_multiplex_ttl",
1366 "http_redirect",
1367 "http_supported_max_version",
1368 "https_cookie_secure",
1369 "id",
1370 "ipv6_mappedip",
1371 "ipv6_mappedport",
1372 "ldb_method",
1373 "mapped_addr",
1374 "mappedip",
1375 "mappedport",
1376 "max_embryonic_connections",
1377 "monitor",
1378 "name",
1379 "nat_source_vip",
1380 "nat44",
1381 "nat46",
1382 "one_click_gslb_server",
1383 "outlook_web_access",
1384 "persistence",
1385 "portforward",
1386 "portmapping_type",
1387 "protocol",
1388 "quic",
1389 "realservers",
1390 "server_type",
1391 "service",
1392 "src_filter",
1393 "src_vip_filter",
1394 "srcintf_filter",
1395 "ssl_accept_ffdhe_groups",
1396 "ssl_algorithm",
1397 "ssl_certificate",
1398 "ssl_certificate_dict",
1399 "ssl_cipher_suites",
1400 "ssl_client_fallback",
1401 "ssl_client_rekey_count",
1402 "ssl_client_renegotiation",
1403 "ssl_client_session_state_max",
1404 "ssl_client_session_state_timeout",
1405 "ssl_client_session_state_type",
1406 "ssl_dh_bits",
1407 "ssl_hpkp",
1408 "ssl_hpkp_age",
1409 "ssl_hpkp_backup",
1410 "ssl_hpkp_include_subdomains",
1411 "ssl_hpkp_primary",
1412 "ssl_hpkp_report_uri",
1413 "ssl_hsts",
1414 "ssl_hsts_age",
1415 "ssl_hsts_include_subdomains",
1416 "ssl_http_location_conversion",
1417 "ssl_http_match_host",
1418 "ssl_max_version",
1419 "ssl_min_version",
1420 "ssl_mode",
1421 "ssl_pfs",
1422 "ssl_send_empty_frags",
1423 "ssl_server_algorithm",
1424 "ssl_server_cipher_suites",
1425 "ssl_server_max_version",
1426 "ssl_server_min_version",
1427 "ssl_server_renegotiation",
1428 "ssl_server_session_state_max",
1429 "ssl_server_session_state_timeout",
1430 "ssl_server_session_state_type",
1431 "status",
1432 "type",
1433 "user_agent_detect",
1434 "uuid",
1435 "weblogic_server",
1436 "websphere_server",
1437 ]
1438
1439 json = remove_invalid_fields(json)
1440 dictionary = {}
1441
1442 for attribute in option_list:
1443 if attribute in json and json[attribute] is not None:
1444 dictionary[attribute] = json[attribute]
1445
1446 return dictionary
1447
1448
1449 def flatten_single_path(data, path, index):
1450 if (
1451 not data
1452 or index == len(path)
1453 or path[index] not in data
1454 or (not data[path[index]] and not isinstance(data[path[index]], list))
1455 ):
1456 return
1457
1458 if index == len(path) - 1:
1459 data[path[index]] = " ".join(str(elem) for elem in data[path[index]])
1460 if len(data[path[index]]) == 0:
1461 data[path[index]] = None
1462 elif isinstance(data[path[index]], list):
1463 for value in data[path[index]]:
1464 flatten_single_path(value, path, index + 1)
1465 else:
1466 flatten_single_path(data[path[index]], path, index + 1)
1467
1468
1469 def flatten_multilists_attributes(data):
1470 multilist_attrs = [
1471 ["ssl_cipher_suites", "versions"],
1472 ["ssl_server_cipher_suites", "versions"],
1473 ]
1474
1475 for attr in multilist_attrs:
1476 flatten_single_path(data, attr, 0)
1477
1478 return data
1479
1480
1481 def underscore_to_hyphen(data):
1482 new_data = None
1483 if isinstance(data, list):
1484 new_data = []
1485 for i, elem in enumerate(data):
1486 new_data.append(underscore_to_hyphen(elem))
1487 elif isinstance(data, dict):
1488 new_data = {}
1489 for k, v in data.items():
1490 new_data[k.replace("_", "-")] = underscore_to_hyphen(v)
1491 else:
1492 return data
1493 return new_data
1494
1495
1496 def remap_attribute_name(data):
1497 speciallist = {"ssl-certificate-dict": "ssl-certificate"}
1498
1499 if data in speciallist:
1500 return speciallist[data]
1501 return data
1502
1503
1504 def remap_attribute_names(data):
1505 if isinstance(data, list):
1506 new_data = []
1507 for elem in data:
1508 elem = remap_attribute_names(elem)
1509 new_data.append(elem)
1510 data = new_data
1511 elif isinstance(data, dict):
1512 new_data = {}
1513 for k, v in data.items():
1514 new_data[remap_attribute_name(k)] = remap_attribute_names(v)
1515 data = new_data
1516
1517 return data
1518
1519
1520 def firewall_vip(data, fos, check_mode=False):
1521
1522 state = None
1523 vdom = data["vdom"]
1524 parameters = None
1525 state = data.get("state", None)
1526 firewall_vip_data = data["firewall_vip"]
1527 # Rename ssl_certificate_dict field to correctly compare against current configuration
1528 if firewall_vip_data.get("ssl_certificate_dict") is not None:
1529 firewall_vip_data["ssl_certificate"] = firewall_vip_data.pop(
1530 "ssl_certificate_dict"
1531 )
1532
1533 filtered_data = filter_firewall_vip_data(firewall_vip_data)
1534 filtered_data = flatten_multilists_attributes(filtered_data)
1535 converted_data = underscore_to_hyphen(filtered_data)
1536 converted_data = remap_attribute_names(converted_data)
1537
1538 # check_mode starts from here
1539 if check_mode:
1540 diff = {
1541 "before": "",
1542 "after": filtered_data,
1543 }
1544 mkeyname = fos.get_mkeyname(None, None)
1545 mkey = fos.get_mkey("firewall", "vip", filtered_data, vdom=vdom)
1546 current_data = fos.get(
1547 "firewall", "vip", vdom=vdom, mkey=mkey, parameters=parameters
1548 )
1549 is_existed = (
1550 current_data
1551 and current_data.get("http_status") == 200
1552 and (
1553 mkeyname
1554 and isinstance(current_data.get("results"), list)
1555 and len(current_data["results"]) > 0
1556 or not mkeyname
1557 and current_data["results"] # global object response
1558 )
1559 )
1560
1561 # 2. if it exists and the state is 'present' then compare current settings with desired
1562 if state == "present" or state is True or state is None:
1563 # for non global modules, mkeyname must exist and it's a new module when mkey is None
1564 if mkeyname is not None and mkey is None:
1565 return False, True, filtered_data, diff
1566
1567 # if mkey exists then compare each other
1568 # record exits and they're matched or not
1569 copied_filtered_data = filtered_data.copy()
1570 copied_filtered_data.pop(mkeyname, None)
1571 unified_filtered_data = unify_data_format(copied_filtered_data)
1572
1573 current_data_results = current_data.get("results", {})
1574 current_config = (
1575 current_data_results[0]
1576 if mkeyname
1577 and isinstance(current_data_results, list)
1578 and len(current_data_results) > 0
1579 else current_data_results
1580 )
1581 if is_existed:
1582 unified_current_values = find_current_values(
1583 unified_filtered_data,
1584 unify_data_format(current_config),
1585 )
1586
1587 is_same = is_same_comparison(
1588 serialize(unified_current_values), serialize(unified_filtered_data)
1589 )
1590
1591 return (
1592 False,
1593 not is_same,
1594 filtered_data,
1595 {"before": unified_current_values, "after": unified_filtered_data},
1596 )
1597
1598 # record does not exist
1599 return False, True, filtered_data, diff
1600
1601 if state == "absent":
1602 if mkey is None:
1603 return (
1604 False,
1605 False,
1606 filtered_data,
1607 {"before": current_data["results"][0], "after": ""},
1608 )
1609
1610 if is_existed:
1611 return (
1612 False,
1613 True,
1614 filtered_data,
1615 {"before": current_data["results"][0], "after": ""},
1616 )
1617 return False, False, filtered_data, {}
1618
1619 return True, False, {"reason: ": "Must provide state parameter"}, {}
1620 # pass post processed data to member operations
1621 # no need to do underscore_to_hyphen since do_member_operation handles it by itself
1622 data_copy = data.copy()
1623 data_copy["firewall_vip"] = filtered_data
1624 fos.do_member_operation(
1625 "firewall",
1626 "vip",
1627 data_copy,
1628 )
1629
1630 if state == "present" or state is True:
1631 return fos.set(
1632 "firewall", "vip", data=converted_data, vdom=vdom, parameters=parameters
1633 )
1634
1635 elif state == "absent":
1636 return fos.delete(
1637 "firewall",
1638 "vip",
1639 mkey=converted_data["name"],
1640 vdom=vdom,
1641 parameters=parameters,
1642 )
1643 else:
1644 fos._module.fail_json(msg="state must be present or absent!")
1645
1646
1647 def is_successful_status(resp):
1648 return (
1649 "status" in resp
1650 and resp["status"] == "success"
1651 or "http_status" in resp
1652 and resp["http_status"] == 200
1653 or "http_method" in resp
1654 and resp["http_method"] == "DELETE"
1655 and resp["http_status"] == 404
1656 )
1657
1658
1659 def fortios_firewall(data, fos, check_mode):
1660
1661 if data["firewall_vip"]:
1662 resp = firewall_vip(data, fos, check_mode)
1663 else:
1664 fos._module.fail_json(msg="missing task body: %s" % ("firewall_vip"))
1665 if isinstance(resp, tuple) and len(resp) == 4:
1666 return resp
1667 return (
1668 not is_successful_status(resp),
1669 is_successful_status(resp)
1670 and (resp["revision_changed"] if "revision_changed" in resp else True),
1671 resp,
1672 {},
1673 )
1674
1675
1676 versioned_schema = {
1677 "type": "list",
1678 "elements": "dict",
1679 "children": {
1680 "name": {"v_range": [["v6.0.0", ""]], "type": "string", "required": True},
1681 "id": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1682 "uuid": {"v_range": [["v6.0.0", ""]], "type": "string"},
1683 "comment": {"v_range": [["v6.0.0", ""]], "type": "string"},
1684 "type": {
1685 "v_range": [["v6.0.0", ""]],
1686 "type": "string",
1687 "options": [
1688 {"value": "static-nat"},
1689 {"value": "load-balance"},
1690 {"value": "server-load-balance"},
1691 {"value": "dns-translation"},
1692 {"value": "fqdn"},
1693 {"value": "access-proxy", "v_range": [["v7.0.0", ""]]},
1694 ],
1695 },
1696 "server_type": {
1697 "v_range": [["v6.0.0", ""]],
1698 "type": "string",
1699 "options": [
1700 {"value": "http"},
1701 {"value": "https"},
1702 {"value": "imaps"},
1703 {"value": "pop3s"},
1704 {"value": "smtps"},
1705 {"value": "ssl"},
1706 {"value": "tcp"},
1707 {"value": "udp"},
1708 {"value": "ip"},
1709 {"value": "ssh", "v_range": [["v7.0.0", "v7.0.0"]]},
1710 ],
1711 },
1712 "dns_mapping_ttl": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1713 "ldb_method": {
1714 "v_range": [["v6.0.0", ""]],
1715 "type": "string",
1716 "options": [
1717 {"value": "static"},
1718 {"value": "round-robin"},
1719 {"value": "weighted"},
1720 {"value": "least-session"},
1721 {"value": "least-rtt"},
1722 {"value": "first-alive"},
1723 {"value": "http-host"},
1724 ],
1725 },
1726 "src_filter": {
1727 "type": "list",
1728 "elements": "dict",
1729 "children": {
1730 "range": {
1731 "v_range": [["v6.0.0", ""]],
1732 "type": "string",
1733 "required": True,
1734 }
1735 },
1736 "v_range": [["v6.0.0", ""]],
1737 },
1738 "src_vip_filter": {
1739 "v_range": [["v7.4.4", ""]],
1740 "type": "string",
1741 "options": [{"value": "disable"}, {"value": "enable"}],
1742 },
1743 "service": {
1744 "type": "list",
1745 "elements": "dict",
1746 "children": {
1747 "name": {
1748 "v_range": [["v6.0.0", ""]],
1749 "type": "string",
1750 "required": True,
1751 }
1752 },
1753 "v_range": [["v6.0.0", ""]],
1754 },
1755 "extip": {"v_range": [["v6.0.0", ""]], "type": "string"},
1756 "extaddr": {
1757 "type": "list",
1758 "elements": "dict",
1759 "children": {
1760 "name": {
1761 "v_range": [["v6.0.0", ""]],
1762 "type": "string",
1763 "required": True,
1764 }
1765 },
1766 "v_range": [["v6.0.0", ""]],
1767 },
1768 "h2_support": {
1769 "v_range": [["v7.4.1", ""]],
1770 "type": "string",
1771 "options": [{"value": "enable"}, {"value": "disable"}],
1772 },
1773 "h3_support": {
1774 "v_range": [["v7.4.1", ""]],
1775 "type": "string",
1776 "options": [{"value": "enable"}, {"value": "disable"}],
1777 },
1778 "quic": {
1779 "v_range": [["v7.4.1", ""]],
1780 "type": "dict",
1781 "children": {
1782 "max_idle_timeout": {"v_range": [["v7.4.1", ""]], "type": "integer"},
1783 "max_udp_payload_size": {
1784 "v_range": [["v7.4.1", ""]],
1785 "type": "integer",
1786 },
1787 "active_connection_id_limit": {
1788 "v_range": [["v7.4.1", ""]],
1789 "type": "integer",
1790 },
1791 "ack_delay_exponent": {"v_range": [["v7.4.1", ""]], "type": "integer"},
1792 "max_ack_delay": {"v_range": [["v7.4.1", ""]], "type": "integer"},
1793 "max_datagram_frame_size": {
1794 "v_range": [["v7.4.1", ""]],
1795 "type": "integer",
1796 },
1797 "active_migration": {
1798 "v_range": [["v7.4.1", ""]],
1799 "type": "string",
1800 "options": [{"value": "enable"}, {"value": "disable"}],
1801 },
1802 "grease_quic_bit": {
1803 "v_range": [["v7.4.1", ""]],
1804 "type": "string",
1805 "options": [{"value": "enable"}, {"value": "disable"}],
1806 },
1807 },
1808 },
1809 "nat44": {
1810 "v_range": [["v7.0.1", ""]],
1811 "type": "string",
1812 "options": [{"value": "disable"}, {"value": "enable"}],
1813 },
1814 "nat46": {
1815 "v_range": [["v7.0.1", ""]],
1816 "type": "string",
1817 "options": [{"value": "disable"}, {"value": "enable"}],
1818 },
1819 "add_nat46_route": {
1820 "v_range": [["v7.0.1", ""]],
1821 "type": "string",
1822 "options": [{"value": "disable"}, {"value": "enable"}],
1823 },
1824 "mappedip": {
1825 "type": "list",
1826 "elements": "dict",
1827 "children": {
1828 "range": {
1829 "v_range": [["v6.0.0", ""]],
1830 "type": "string",
1831 "required": True,
1832 }
1833 },
1834 "v_range": [["v6.0.0", ""]],
1835 },
1836 "mapped_addr": {"v_range": [["v6.0.0", ""]], "type": "string"},
1837 "extintf": {"v_range": [["v6.0.0", ""]], "type": "string"},
1838 "arp_reply": {
1839 "v_range": [["v6.0.0", ""]],
1840 "type": "string",
1841 "options": [{"value": "disable"}, {"value": "enable"}],
1842 },
1843 "http_redirect": {
1844 "v_range": [["v6.2.0", ""]],
1845 "type": "string",
1846 "options": [{"value": "enable"}, {"value": "disable"}],
1847 },
1848 "persistence": {
1849 "v_range": [["v6.0.0", ""]],
1850 "type": "string",
1851 "options": [
1852 {"value": "none"},
1853 {"value": "http-cookie"},
1854 {"value": "ssl-session-id"},
1855 ],
1856 },
1857 "nat_source_vip": {
1858 "v_range": [["v6.0.0", ""]],
1859 "type": "string",
1860 "options": [{"value": "disable"}, {"value": "enable"}],
1861 },
1862 "portforward": {
1863 "v_range": [["v6.0.0", ""]],
1864 "type": "string",
1865 "options": [{"value": "disable"}, {"value": "enable"}],
1866 },
1867 "status": {
1868 "v_range": [["v7.0.0", ""]],
1869 "type": "string",
1870 "options": [{"value": "disable"}, {"value": "enable"}],
1871 },
1872 "protocol": {
1873 "v_range": [["v6.0.0", ""]],
1874 "type": "string",
1875 "options": [
1876 {"value": "tcp"},
1877 {"value": "udp"},
1878 {"value": "sctp"},
1879 {"value": "icmp"},
1880 ],
1881 },
1882 "extport": {"v_range": [["v6.0.0", ""]], "type": "string"},
1883 "mappedport": {"v_range": [["v6.0.0", ""]], "type": "string"},
1884 "gratuitous_arp_interval": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1885 "srcintf_filter": {
1886 "type": "list",
1887 "elements": "dict",
1888 "children": {
1889 "interface_name": {
1890 "v_range": [["v6.0.0", ""]],
1891 "type": "string",
1892 "required": True,
1893 }
1894 },
1895 "v_range": [["v6.0.0", ""]],
1896 },
1897 "portmapping_type": {
1898 "v_range": [["v6.0.0", ""]],
1899 "type": "string",
1900 "options": [{"value": "1-to-1"}, {"value": "m-to-n"}],
1901 },
1902 "empty_cert_action": {
1903 "v_range": [["v7.6.1", ""]],
1904 "type": "string",
1905 "options": [
1906 {"value": "accept"},
1907 {"value": "block"},
1908 {"value": "accept-unmanageable"},
1909 ],
1910 },
1911 "user_agent_detect": {
1912 "v_range": [["v7.6.1", ""]],
1913 "type": "string",
1914 "options": [{"value": "disable"}, {"value": "enable"}],
1915 },
1916 "client_cert": {
1917 "v_range": [["v7.6.1", ""]],
1918 "type": "string",
1919 "options": [{"value": "disable"}, {"value": "enable"}],
1920 },
1921 "realservers": {
1922 "type": "list",
1923 "elements": "dict",
1924 "children": {
1925 "id": {
1926 "v_range": [["v6.0.0", ""]],
1927 "type": "integer",
1928 "required": True,
1929 },
1930 "type": {
1931 "v_range": [["v6.4.0", ""]],
1932 "type": "string",
1933 "options": [{"value": "ip"}, {"value": "address"}],
1934 },
1935 "address": {"v_range": [["v6.4.0", ""]], "type": "string"},
1936 "ip": {"v_range": [["v6.0.0", ""]], "type": "string"},
1937 "port": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1938 "status": {
1939 "v_range": [["v6.0.0", ""]],
1940 "type": "string",
1941 "options": [
1942 {"value": "active"},
1943 {"value": "standby"},
1944 {"value": "disable"},
1945 ],
1946 },
1947 "weight": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1948 "holddown_interval": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1949 "healthcheck": {
1950 "v_range": [["v6.0.0", ""]],
1951 "type": "string",
1952 "options": [
1953 {"value": "disable"},
1954 {"value": "enable"},
1955 {"value": "vip"},
1956 ],
1957 },
1958 "http_host": {"v_range": [["v6.0.0", ""]], "type": "string"},
1959 "translate_host": {
1960 "v_range": [["v7.2.4", ""]],
1961 "type": "string",
1962 "options": [{"value": "enable"}, {"value": "disable"}],
1963 },
1964 "max_connections": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1965 "monitor": {
1966 "type": "list",
1967 "elements": "dict",
1968 "children": {
1969 "name": {
1970 "v_range": [["v6.4.0", ""]],
1971 "type": "string",
1972 "required": True,
1973 }
1974 },
1975 "v_range": [["v6.0.0", ""]],
1976 },
1977 "client_ip": {"v_range": [["v6.0.0", ""]], "type": "string"},
1978 "verify_cert": {
1979 "v_range": [["v7.6.3", ""]],
1980 "type": "string",
1981 "options": [{"value": "enable"}, {"value": "disable"}],
1982 },
1983 },
1984 "v_range": [["v6.0.0", ""]],
1985 },
1986 "http_cookie_domain_from_host": {
1987 "v_range": [["v6.0.0", ""]],
1988 "type": "string",
1989 "options": [{"value": "disable"}, {"value": "enable"}],
1990 },
1991 "http_cookie_domain": {"v_range": [["v6.0.0", ""]], "type": "string"},
1992 "http_cookie_path": {"v_range": [["v6.0.0", ""]], "type": "string"},
1993 "http_cookie_generation": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1994 "http_cookie_age": {"v_range": [["v6.0.0", ""]], "type": "integer"},
1995 "http_cookie_share": {
1996 "v_range": [["v6.0.0", ""]],
1997 "type": "string",
1998 "options": [{"value": "disable"}, {"value": "same-ip"}],
1999 },
2000 "https_cookie_secure": {
2001 "v_range": [["v6.0.0", ""]],
2002 "type": "string",
2003 "options": [{"value": "disable"}, {"value": "enable"}],
2004 },
2005 "http_multiplex": {
2006 "v_range": [["v6.0.0", ""]],
2007 "type": "string",
2008 "options": [{"value": "enable"}, {"value": "disable"}],
2009 },
2010 "http_multiplex_ttl": {"v_range": [["v7.2.4", ""]], "type": "integer"},
2011 "http_multiplex_max_request": {"v_range": [["v7.2.4", ""]], "type": "integer"},
2012 "http_multiplex_max_concurrent_request": {
2013 "v_range": [["v7.4.1", ""]],
2014 "type": "integer",
2015 },
2016 "http_ip_header": {
2017 "v_range": [["v6.0.0", ""]],
2018 "type": "string",
2019 "options": [{"value": "enable"}, {"value": "disable"}],
2020 },
2021 "http_ip_header_name": {"v_range": [["v6.0.0", ""]], "type": "string"},
2022 "outlook_web_access": {
2023 "v_range": [["v6.0.0", ""]],
2024 "type": "string",
2025 "options": [{"value": "disable"}, {"value": "enable"}],
2026 },
2027 "weblogic_server": {
2028 "v_range": [["v6.0.0", ""]],
2029 "type": "string",
2030 "options": [{"value": "disable"}, {"value": "enable"}],
2031 },
2032 "websphere_server": {
2033 "v_range": [["v6.0.0", ""]],
2034 "type": "string",
2035 "options": [{"value": "disable"}, {"value": "enable"}],
2036 },
2037 "ssl_mode": {
2038 "v_range": [["v6.0.0", ""]],
2039 "type": "string",
2040 "options": [{"value": "half"}, {"value": "full"}],
2041 },
2042 "ssl_certificate_dict": {
2043 "type": "list",
2044 "elements": "dict",
2045 "children": {
2046 "name": {
2047 "v_range": [["v7.4.2", ""]],
2048 "type": "string",
2049 "required": True,
2050 }
2051 },
2052 "v_range": [["v7.4.2", ""]],
2053 },
2054 "ssl_dh_bits": {
2055 "v_range": [["v6.0.0", ""]],
2056 "type": "string",
2057 "options": [
2058 {"value": "768"},
2059 {"value": "1024"},
2060 {"value": "1536"},
2061 {"value": "2048"},
2062 {"value": "3072"},
2063 {"value": "4096"},
2064 ],
2065 },
2066 "ssl_algorithm": {
2067 "v_range": [["v6.0.0", ""]],
2068 "type": "string",
2069 "options": [
2070 {"value": "high"},
2071 {"value": "medium"},
2072 {"value": "low"},
2073 {"value": "custom"},
2074 ],
2075 },
2076 "ssl_cipher_suites": {
2077 "type": "list",
2078 "elements": "dict",
2079 "children": {
2080 "priority": {
2081 "v_range": [["v6.0.0", ""]],
2082 "type": "integer",
2083 "required": True,
2084 },
2085 "cipher": {
2086 "v_range": [["v6.0.0", ""]],
2087 "type": "string",
2088 "options": [
2089 {
2090 "value": "TLS-AES-128-GCM-SHA256",
2091 "v_range": [["v6.2.0", ""]],
2092 },
2093 {
2094 "value": "TLS-AES-256-GCM-SHA384",
2095 "v_range": [["v6.2.0", ""]],
2096 },
2097 {
2098 "value": "TLS-CHACHA20-POLY1305-SHA256",
2099 "v_range": [["v6.2.0", ""]],
2100 },
2101 {"value": "TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256"},
2102 {"value": "TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256"},
2103 {"value": "TLS-DHE-RSA-WITH-CHACHA20-POLY1305-SHA256"},
2104 {"value": "TLS-DHE-RSA-WITH-AES-128-CBC-SHA"},
2105 {"value": "TLS-DHE-RSA-WITH-AES-256-CBC-SHA"},
2106 {"value": "TLS-DHE-RSA-WITH-AES-128-CBC-SHA256"},
2107 {"value": "TLS-DHE-RSA-WITH-AES-128-GCM-SHA256"},
2108 {"value": "TLS-DHE-RSA-WITH-AES-256-CBC-SHA256"},
2109 {"value": "TLS-DHE-RSA-WITH-AES-256-GCM-SHA384"},
2110 {"value": "TLS-DHE-DSS-WITH-AES-128-CBC-SHA"},
2111 {"value": "TLS-DHE-DSS-WITH-AES-256-CBC-SHA"},
2112 {"value": "TLS-DHE-DSS-WITH-AES-128-CBC-SHA256"},
2113 {"value": "TLS-DHE-DSS-WITH-AES-128-GCM-SHA256"},
2114 {"value": "TLS-DHE-DSS-WITH-AES-256-CBC-SHA256"},
2115 {"value": "TLS-DHE-DSS-WITH-AES-256-GCM-SHA384"},
2116 {"value": "TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA"},
2117 {"value": "TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256"},
2118 {"value": "TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256"},
2119 {"value": "TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA"},
2120 {"value": "TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384"},
2121 {"value": "TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384"},
2122 {"value": "TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA"},
2123 {"value": "TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256"},
2124 {"value": "TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256"},
2125 {
2126 "value": "TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA",
2127 "v_range": [["v7.0.1", ""]],
2128 },
2129 {"value": "TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384"},
2130 {"value": "TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384"},
2131 {"value": "TLS-RSA-WITH-AES-128-CBC-SHA"},
2132 {"value": "TLS-RSA-WITH-AES-256-CBC-SHA"},
2133 {"value": "TLS-RSA-WITH-AES-128-CBC-SHA256"},
2134 {"value": "TLS-RSA-WITH-AES-128-GCM-SHA256"},
2135 {"value": "TLS-RSA-WITH-AES-256-CBC-SHA256"},
2136 {"value": "TLS-RSA-WITH-AES-256-GCM-SHA384"},
2137 {"value": "TLS-RSA-WITH-CAMELLIA-128-CBC-SHA"},
2138 {"value": "TLS-RSA-WITH-CAMELLIA-256-CBC-SHA"},
2139 {"value": "TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256"},
2140 {"value": "TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256"},
2141 {"value": "TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA"},
2142 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA"},
2143 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA"},
2144 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA"},
2145 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA"},
2146 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256"},
2147 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA256"},
2148 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256"},
2149 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA256"},
2150 {"value": "TLS-DHE-RSA-WITH-SEED-CBC-SHA"},
2151 {"value": "TLS-DHE-DSS-WITH-SEED-CBC-SHA"},
2152 {"value": "TLS-DHE-RSA-WITH-ARIA-128-CBC-SHA256"},
2153 {"value": "TLS-DHE-RSA-WITH-ARIA-256-CBC-SHA384"},
2154 {"value": "TLS-DHE-DSS-WITH-ARIA-128-CBC-SHA256"},
2155 {"value": "TLS-DHE-DSS-WITH-ARIA-256-CBC-SHA384"},
2156 {"value": "TLS-RSA-WITH-SEED-CBC-SHA"},
2157 {"value": "TLS-RSA-WITH-ARIA-128-CBC-SHA256"},
2158 {"value": "TLS-RSA-WITH-ARIA-256-CBC-SHA384"},
2159 {"value": "TLS-ECDHE-RSA-WITH-ARIA-128-CBC-SHA256"},
2160 {"value": "TLS-ECDHE-RSA-WITH-ARIA-256-CBC-SHA384"},
2161 {"value": "TLS-ECDHE-ECDSA-WITH-ARIA-128-CBC-SHA256"},
2162 {"value": "TLS-ECDHE-ECDSA-WITH-ARIA-256-CBC-SHA384"},
2163 {"value": "TLS-ECDHE-RSA-WITH-RC4-128-SHA"},
2164 {"value": "TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA"},
2165 {"value": "TLS-DHE-DSS-WITH-3DES-EDE-CBC-SHA"},
2166 {"value": "TLS-RSA-WITH-3DES-EDE-CBC-SHA"},
2167 {"value": "TLS-RSA-WITH-RC4-128-MD5"},
2168 {"value": "TLS-RSA-WITH-RC4-128-SHA"},
2169 {"value": "TLS-DHE-RSA-WITH-DES-CBC-SHA"},
2170 {"value": "TLS-DHE-DSS-WITH-DES-CBC-SHA"},
2171 {"value": "TLS-RSA-WITH-DES-CBC-SHA"},
2172 ],
2173 },
2174 "versions": {
2175 "v_range": [["v6.0.0", ""]],
2176 "type": "list",
2177 "options": [
2178 {"value": "ssl-3.0"},
2179 {"value": "tls-1.0"},
2180 {"value": "tls-1.1"},
2181 {"value": "tls-1.2"},
2182 {"value": "tls-1.3", "v_range": [["v6.2.0", ""]]},
2183 ],
2184 "multiple_values": True,
2185 "elements": "str",
2186 },
2187 },
2188 "v_range": [["v6.0.0", ""]],
2189 },
2190 "ssl_server_algorithm": {
2191 "v_range": [["v6.0.0", ""]],
2192 "type": "string",
2193 "options": [
2194 {"value": "high"},
2195 {"value": "medium"},
2196 {"value": "low"},
2197 {"value": "custom"},
2198 {"value": "client"},
2199 ],
2200 },
2201 "ssl_server_cipher_suites": {
2202 "type": "list",
2203 "elements": "dict",
2204 "children": {
2205 "priority": {
2206 "v_range": [["v6.0.0", ""]],
2207 "type": "integer",
2208 "required": True,
2209 },
2210 "cipher": {
2211 "v_range": [["v6.0.0", ""]],
2212 "type": "string",
2213 "options": [
2214 {
2215 "value": "TLS-AES-128-GCM-SHA256",
2216 "v_range": [["v6.2.0", ""]],
2217 },
2218 {
2219 "value": "TLS-AES-256-GCM-SHA384",
2220 "v_range": [["v6.2.0", ""]],
2221 },
2222 {
2223 "value": "TLS-CHACHA20-POLY1305-SHA256",
2224 "v_range": [["v6.2.0", ""]],
2225 },
2226 {"value": "TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256"},
2227 {"value": "TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256"},
2228 {"value": "TLS-DHE-RSA-WITH-CHACHA20-POLY1305-SHA256"},
2229 {"value": "TLS-DHE-RSA-WITH-AES-128-CBC-SHA"},
2230 {"value": "TLS-DHE-RSA-WITH-AES-256-CBC-SHA"},
2231 {"value": "TLS-DHE-RSA-WITH-AES-128-CBC-SHA256"},
2232 {"value": "TLS-DHE-RSA-WITH-AES-128-GCM-SHA256"},
2233 {"value": "TLS-DHE-RSA-WITH-AES-256-CBC-SHA256"},
2234 {"value": "TLS-DHE-RSA-WITH-AES-256-GCM-SHA384"},
2235 {"value": "TLS-DHE-DSS-WITH-AES-128-CBC-SHA"},
2236 {"value": "TLS-DHE-DSS-WITH-AES-256-CBC-SHA"},
2237 {"value": "TLS-DHE-DSS-WITH-AES-128-CBC-SHA256"},
2238 {"value": "TLS-DHE-DSS-WITH-AES-128-GCM-SHA256"},
2239 {"value": "TLS-DHE-DSS-WITH-AES-256-CBC-SHA256"},
2240 {"value": "TLS-DHE-DSS-WITH-AES-256-GCM-SHA384"},
2241 {"value": "TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA"},
2242 {"value": "TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256"},
2243 {"value": "TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256"},
2244 {"value": "TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA"},
2245 {"value": "TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384"},
2246 {"value": "TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384"},
2247 {"value": "TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA"},
2248 {"value": "TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256"},
2249 {"value": "TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256"},
2250 {
2251 "value": "TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA",
2252 "v_range": [["v7.0.1", ""]],
2253 },
2254 {"value": "TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384"},
2255 {"value": "TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384"},
2256 {"value": "TLS-RSA-WITH-AES-128-CBC-SHA"},
2257 {"value": "TLS-RSA-WITH-AES-256-CBC-SHA"},
2258 {"value": "TLS-RSA-WITH-AES-128-CBC-SHA256"},
2259 {"value": "TLS-RSA-WITH-AES-128-GCM-SHA256"},
2260 {"value": "TLS-RSA-WITH-AES-256-CBC-SHA256"},
2261 {"value": "TLS-RSA-WITH-AES-256-GCM-SHA384"},
2262 {"value": "TLS-RSA-WITH-CAMELLIA-128-CBC-SHA"},
2263 {"value": "TLS-RSA-WITH-CAMELLIA-256-CBC-SHA"},
2264 {"value": "TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256"},
2265 {"value": "TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256"},
2266 {"value": "TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA"},
2267 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA"},
2268 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA"},
2269 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA"},
2270 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA"},
2271 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256"},
2272 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA256"},
2273 {"value": "TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256"},
2274 {"value": "TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA256"},
2275 {"value": "TLS-DHE-RSA-WITH-SEED-CBC-SHA"},
2276 {"value": "TLS-DHE-DSS-WITH-SEED-CBC-SHA"},
2277 {"value": "TLS-DHE-RSA-WITH-ARIA-128-CBC-SHA256"},
2278 {"value": "TLS-DHE-RSA-WITH-ARIA-256-CBC-SHA384"},
2279 {"value": "TLS-DHE-DSS-WITH-ARIA-128-CBC-SHA256"},
2280 {"value": "TLS-DHE-DSS-WITH-ARIA-256-CBC-SHA384"},
2281 {"value": "TLS-RSA-WITH-SEED-CBC-SHA"},
2282 {"value": "TLS-RSA-WITH-ARIA-128-CBC-SHA256"},
2283 {"value": "TLS-RSA-WITH-ARIA-256-CBC-SHA384"},
2284 {"value": "TLS-ECDHE-RSA-WITH-ARIA-128-CBC-SHA256"},
2285 {"value": "TLS-ECDHE-RSA-WITH-ARIA-256-CBC-SHA384"},
2286 {"value": "TLS-ECDHE-ECDSA-WITH-ARIA-128-CBC-SHA256"},
2287 {"value": "TLS-ECDHE-ECDSA-WITH-ARIA-256-CBC-SHA384"},
2288 {"value": "TLS-ECDHE-RSA-WITH-RC4-128-SHA"},
2289 {"value": "TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA"},
2290 {"value": "TLS-DHE-DSS-WITH-3DES-EDE-CBC-SHA"},
2291 {"value": "TLS-RSA-WITH-3DES-EDE-CBC-SHA"},
2292 {"value": "TLS-RSA-WITH-RC4-128-MD5"},
2293 {"value": "TLS-RSA-WITH-RC4-128-SHA"},
2294 {"value": "TLS-DHE-RSA-WITH-DES-CBC-SHA"},
2295 {"value": "TLS-DHE-DSS-WITH-DES-CBC-SHA"},
2296 {"value": "TLS-RSA-WITH-DES-CBC-SHA"},
2297 ],
2298 },
2299 "versions": {
2300 "v_range": [["v6.0.0", ""]],
2301 "type": "list",
2302 "options": [
2303 {"value": "ssl-3.0"},
2304 {"value": "tls-1.0"},
2305 {"value": "tls-1.1"},
2306 {"value": "tls-1.2"},
2307 {"value": "tls-1.3", "v_range": [["v6.2.0", ""]]},
2308 ],
2309 "multiple_values": True,
2310 "elements": "str",
2311 },
2312 },
2313 "v_range": [["v6.0.0", ""]],
2314 },
2315 "ssl_pfs": {
2316 "v_range": [["v6.0.0", ""]],
2317 "type": "string",
2318 "options": [{"value": "require"}, {"value": "deny"}, {"value": "allow"}],
2319 },
2320 "ssl_min_version": {
2321 "v_range": [["v6.0.0", ""]],
2322 "type": "string",
2323 "options": [
2324 {"value": "ssl-3.0"},
2325 {"value": "tls-1.0"},
2326 {"value": "tls-1.1"},
2327 {"value": "tls-1.2"},
2328 {"value": "tls-1.3", "v_range": [["v6.2.0", ""]]},
2329 ],
2330 },
2331 "ssl_max_version": {
2332 "v_range": [["v6.0.0", ""]],
2333 "type": "string",
2334 "options": [
2335 {"value": "ssl-3.0"},
2336 {"value": "tls-1.0"},
2337 {"value": "tls-1.1"},
2338 {"value": "tls-1.2"},
2339 {"value": "tls-1.3", "v_range": [["v6.2.0", ""]]},
2340 ],
2341 },
2342 "ssl_server_min_version": {
2343 "v_range": [["v6.0.0", ""]],
2344 "type": "string",
2345 "options": [
2346 {"value": "ssl-3.0"},
2347 {"value": "tls-1.0"},
2348 {"value": "tls-1.1"},
2349 {"value": "tls-1.2"},
2350 {"value": "tls-1.3", "v_range": [["v6.2.0", ""]]},
2351 {"value": "client"},
2352 ],
2353 },
2354 "ssl_server_max_version": {
2355 "v_range": [["v6.0.0", ""]],
2356 "type": "string",
2357 "options": [
2358 {"value": "ssl-3.0"},
2359 {"value": "tls-1.0"},
2360 {"value": "tls-1.1"},
2361 {"value": "tls-1.2"},
2362 {"value": "tls-1.3", "v_range": [["v6.2.0", ""]]},
2363 {"value": "client"},
2364 ],
2365 },
2366 "ssl_accept_ffdhe_groups": {
2367 "v_range": [["v7.0.4", ""]],
2368 "type": "string",
2369 "options": [{"value": "enable"}, {"value": "disable"}],
2370 },
2371 "ssl_send_empty_frags": {
2372 "v_range": [["v6.0.0", ""]],
2373 "type": "string",
2374 "options": [{"value": "enable"}, {"value": "disable"}],
2375 },
2376 "ssl_client_fallback": {
2377 "v_range": [["v6.0.0", ""]],
2378 "type": "string",
2379 "options": [{"value": "disable"}, {"value": "enable"}],
2380 },
2381 "ssl_client_renegotiation": {
2382 "v_range": [["v6.0.0", ""]],
2383 "type": "string",
2384 "options": [{"value": "allow"}, {"value": "deny"}, {"value": "secure"}],
2385 },
2386 "ssl_client_session_state_type": {
2387 "v_range": [["v6.0.0", ""]],
2388 "type": "string",
2389 "options": [
2390 {"value": "disable"},
2391 {"value": "time"},
2392 {"value": "count"},
2393 {"value": "both"},
2394 ],
2395 },
2396 "ssl_client_session_state_timeout": {
2397 "v_range": [["v6.0.0", ""]],
2398 "type": "integer",
2399 },
2400 "ssl_client_session_state_max": {
2401 "v_range": [["v6.0.0", ""]],
2402 "type": "integer",
2403 },
2404 "ssl_client_rekey_count": {"v_range": [["v6.2.0", ""]], "type": "integer"},
2405 "ssl_server_renegotiation": {
2406 "v_range": [["v7.2.4", ""]],
2407 "type": "string",
2408 "options": [{"value": "enable"}, {"value": "disable"}],
2409 },
2410 "ssl_server_session_state_type": {
2411 "v_range": [["v6.0.0", ""]],
2412 "type": "string",
2413 "options": [
2414 {"value": "disable"},
2415 {"value": "time"},
2416 {"value": "count"},
2417 {"value": "both"},
2418 ],
2419 },
2420 "ssl_server_session_state_timeout": {
2421 "v_range": [["v6.0.0", ""]],
2422 "type": "integer",
2423 },
2424 "ssl_server_session_state_max": {
2425 "v_range": [["v6.0.0", ""]],
2426 "type": "integer",
2427 },
2428 "ssl_http_location_conversion": {
2429 "v_range": [["v6.0.0", ""]],
2430 "type": "string",
2431 "options": [{"value": "enable"}, {"value": "disable"}],
2432 },
2433 "ssl_http_match_host": {
2434 "v_range": [["v6.0.0", ""]],
2435 "type": "string",
2436 "options": [{"value": "enable"}, {"value": "disable"}],
2437 },
2438 "ssl_hpkp": {
2439 "v_range": [["v6.0.0", ""]],
2440 "type": "string",
2441 "options": [
2442 {"value": "disable"},
2443 {"value": "enable"},
2444 {"value": "report-only"},
2445 ],
2446 },
2447 "ssl_hpkp_primary": {"v_range": [["v6.0.0", ""]], "type": "string"},
2448 "ssl_hpkp_backup": {"v_range": [["v6.0.0", ""]], "type": "string"},
2449 "ssl_hpkp_age": {"v_range": [["v6.0.0", ""]], "type": "integer"},
2450 "ssl_hpkp_report_uri": {"v_range": [["v6.0.0", ""]], "type": "string"},
2451 "ssl_hpkp_include_subdomains": {
2452 "v_range": [["v6.0.0", ""]],
2453 "type": "string",
2454 "options": [{"value": "disable"}, {"value": "enable"}],
2455 },
2456 "ssl_hsts": {
2457 "v_range": [["v6.0.0", ""]],
2458 "type": "string",
2459 "options": [{"value": "disable"}, {"value": "enable"}],
2460 },
2461 "ssl_hsts_age": {"v_range": [["v6.0.0", ""]], "type": "integer"},
2462 "ssl_hsts_include_subdomains": {
2463 "v_range": [["v6.0.0", ""]],
2464 "type": "string",
2465 "options": [{"value": "disable"}, {"value": "enable"}],
2466 },
2467 "monitor": {
2468 "type": "list",
2469 "elements": "dict",
2470 "children": {
2471 "name": {
2472 "v_range": [["v6.0.0", ""]],
2473 "type": "string",
2474 "required": True,
2475 }
2476 },
2477 "v_range": [["v6.0.0", ""]],
2478 },
2479 "max_embryonic_connections": {"v_range": [["v6.0.0", ""]], "type": "integer"},
2480 "color": {"v_range": [["v6.0.0", ""]], "type": "integer"},
2481 "ipv6_mappedip": {"v_range": [["v7.0.1", ""]], "type": "string"},
2482 "ipv6_mappedport": {"v_range": [["v7.0.1", ""]], "type": "string"},
2483 "one_click_gslb_server": {
2484 "v_range": [["v7.4.2", ""]],
2485 "type": "string",
2486 "options": [{"value": "disable"}, {"value": "enable"}],
2487 },
2488 "gslb_hostname": {"v_range": [["v7.4.2", ""]], "type": "string"},
2489 "gslb_domain_name": {"v_range": [["v7.4.2", ""]], "type": "string"},
2490 "gslb_public_ips": {
2491 "type": "list",
2492 "elements": "dict",
2493 "children": {
2494 "index": {
2495 "v_range": [["v7.4.2", ""]],
2496 "type": "integer",
2497 "required": True,
2498 },
2499 "ip": {"v_range": [["v7.4.2", ""]], "type": "string"},
2500 },
2501 "v_range": [["v7.4.2", ""]],
2502 },
2503 "ssl_certificate": {"v_range": [["v6.0.0", "v7.4.1"]], "type": "string"},
2504 "http_supported_max_version": {
2505 "v_range": [["v7.2.4", "v7.4.0"]],
2506 "type": "string",
2507 "options": [{"value": "http1"}, {"value": "http2"}],
2508 },
2509 },
2510 "v_range": [["v6.0.0", ""]],
2511 }
2512
2513
2514 def main():
2515 module_spec = schema_to_module_spec(versioned_schema)
2516 mkeyname = "name"
2517 fields = {
2518 "access_token": {"required": False, "type": "str", "no_log": True},
2519 "enable_log": {"required": False, "type": "bool", "default": False},
2520 "vdom": {"required": False, "type": "str", "default": "root"},
2521 "member_path": {"required": False, "type": "str"},
2522 "member_state": {
2523 "type": "str",
2524 "required": False,
2525 "choices": ["present", "absent"],
2526 },
2527 "state": {"required": True, "type": "str", "choices": ["present", "absent"]},
2528 "firewall_vip": {
2529 "required": False,
2530 "type": "dict",
2531 "default": None,
2532 "options": {},
2533 },
2534 }
2535 for attribute_name in module_spec["options"]:
2536 fields["firewall_vip"]["options"][attribute_name] = module_spec["options"][
2537 attribute_name
2538 ]
2539 if mkeyname and mkeyname == attribute_name:
2540 fields["firewall_vip"]["options"][attribute_name]["required"] = True
2541
2542 module = AnsibleModule(argument_spec=fields, supports_check_mode=True)
2543 check_legacy_fortiosapi(module)
2544
2545 is_error = False
2546 has_changed = False
2547 result = None
2548 diff = None
2549
2550 versions_check_result = None
2551 if module._socket_path:
2552 connection = Connection(module._socket_path)
2553 if "access_token" in module.params:
2554 connection.set_custom_option("access_token", module.params["access_token"])
2555
2556 if "enable_log" in module.params:
2557 connection.set_custom_option("enable_log", module.params["enable_log"])
2558 else:
2559 connection.set_custom_option("enable_log", False)
2560 fos = FortiOSHandler(connection, module, mkeyname, admin_passwd_header=False)
2561 versions_check_result = check_schema_versioning(
2562 fos, versioned_schema, "firewall_vip"
2563 )
2564
2565 is_error, has_changed, result, diff = fortios_firewall(
2566 module.params, fos, module.check_mode
2567 )
2568
2569 else:
2570 module.fail_json(**FAIL_SOCKET_MSG)
2571
2572 if versions_check_result and versions_check_result["matched"] is False:
2573 module.warn(
2574 "Ansible has detected version mismatch between FortOS system and your playbook, see more details by specifying option -vvv"
2575 )
2576
2577 if not is_error:
2578 if versions_check_result and versions_check_result["matched"] is False:
2579 module.exit_json(
2580 changed=has_changed,
2581 version_check_warning=versions_check_result,
2582 meta=result,
2583 diff=diff,
2584 )
2585 else:
2586 module.exit_json(changed=has_changed, meta=result, diff=diff)
2587 else:
2588 if versions_check_result and versions_check_result["matched"] is False:
2589 module.fail_json(
2590 msg="Error in repo",
2591 version_check_warning=versions_check_result,
2592 meta=result,
2593 )
2594 else:
2595 module.fail_json(msg="Error in repo", meta=result)
2596
2597
2598 if __name__ == "__main__":
2599 main()