Debian Codegraph @

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

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3 # Copyright 2019-2024 Fortinet, Inc.
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 __metaclass__ = type
7
8 ANSIBLE_METADATA = {'status': ['preview'],
9 'supported_by': 'community',
10 'metadata_version': '1.1'}
11
12 DOCUMENTATION = '''
13 ---
14 module: fmgr_firewall_vip_dynamicmapping
15 short_description: Configure virtual IP for IPv4.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 vip:
29 description: The parameter (vip) in requested url.
30 type: str
31 required: true
32 firewall_vip_dynamicmapping:
33 description: The top level parameters set.
34 required: false
35 type: dict
36 suboptions:
37 _scope:
38 type: list
39 elements: dict
40 description: Scope.
41 suboptions:
42 name:
43 type: str
44 description: Name.
45 vdom:
46 type: str
47 description: Vdom.
48 arp_reply:
49 aliases: ['arp-reply']
50 type: str
51 description: Arp reply.
52 choices: ['disable', 'enable']
53 color:
54 type: int
55 description: Color.
56 comment:
57 type: str
58 description: Comment.
59 dns_mapping_ttl:
60 aliases: ['dns-mapping-ttl']
61 type: int
62 description: Dns mapping ttl.
63 extaddr:
64 type: raw
65 description: (list or str) Extaddr.
66 extintf:
67 type: str
68 description: Extintf.
69 extip:
70 type: str
71 description: Extip.
72 extport:
73 type: str
74 description: Extport.
75 gratuitous_arp_interval:
76 aliases: ['gratuitous-arp-interval']
77 type: int
78 description: Gratuitous arp interval.
79 http_cookie_age:
80 aliases: ['http-cookie-age']
81 type: int
82 description: Http cookie age.
83 http_cookie_domain:
84 aliases: ['http-cookie-domain']
85 type: str
86 description: Http cookie domain.
87 http_cookie_domain_from_host:
88 aliases: ['http-cookie-domain-from-host']
89 type: str
90 description: Http cookie domain from host.
91 choices: ['disable', 'enable']
92 http_cookie_generation:
93 aliases: ['http-cookie-generation']
94 type: int
95 description: Http cookie generation.
96 http_cookie_path:
97 aliases: ['http-cookie-path']
98 type: str
99 description: Http cookie path.
100 http_cookie_share:
101 aliases: ['http-cookie-share']
102 type: str
103 description: Http cookie share.
104 choices: ['disable', 'same-ip']
105 http_ip_header:
106 aliases: ['http-ip-header']
107 type: str
108 description: Http ip header.
109 choices: ['disable', 'enable']
110 http_ip_header_name:
111 aliases: ['http-ip-header-name']
112 type: str
113 description: Http ip header name.
114 http_multiplex:
115 aliases: ['http-multiplex']
116 type: str
117 description: Http multiplex.
118 choices: ['disable', 'enable']
119 https_cookie_secure:
120 aliases: ['https-cookie-secure']
121 type: str
122 description: Https cookie secure.
123 choices: ['disable', 'enable']
124 id:
125 type: int
126 description: Id.
127 ldb_method:
128 aliases: ['ldb-method']
129 type: str
130 description: Ldb method.
131 choices: ['static', 'round-robin', 'weighted', 'least-session', 'least-rtt',
132 'first-alive', 'http-host']
133 mapped_addr:
134 aliases: ['mapped-addr']
135 type: str
136 description: Mapped addr.
137 mappedip:
138 type: raw
139 description: (list) Mappedip.
140 mappedport:
141 type: str
142 description: Mappedport.
143 max_embryonic_connections:
144 aliases: ['max-embryonic-connections']
145 type: int
146 description: Max embryonic connections.
147 monitor:
148 type: raw
149 description: (list or str) Monitor.
150 nat_source_vip:
151 aliases: ['nat-source-vip']
152 type: str
153 description: Nat source vip.
154 choices: ['disable', 'enable']
155 outlook_web_access:
156 aliases: ['outlook-web-access']
157 type: str
158 description: Outlook web access.
159 choices: ['disable', 'enable']
160 persistence:
161 type: str
162 description: Persistence.
163 choices: ['none', 'http-cookie', 'ssl-session-id']
164 portforward:
165 type: str
166 description: Portforward.
167 choices: ['disable', 'enable']
168 portmapping_type:
169 aliases: ['portmapping-type']
170 type: str
171 description: Portmapping type.
172 choices: ['1-to-1', 'm-to-n']
173 protocol:
174 type: str
175 description: Protocol.
176 choices: ['tcp', 'udp', 'sctp', 'icmp']
177 realservers:
178 type: list
179 elements: dict
180 description: Realservers.
181 suboptions:
182 client_ip:
183 aliases: ['client-ip']
184 type: raw
185 description: (list) Client ip.
186 healthcheck:
187 type: str
188 description: Healthcheck.
189 choices: ['disable', 'enable', 'vip']
190 holddown_interval:
191 aliases: ['holddown-interval']
192 type: int
193 description: Holddown interval.
194 http_host:
195 aliases: ['http-host']
196 type: str
197 description: Http host.
198 ip:
199 type: str
200 description: Ip.
201 max_connections:
202 aliases: ['max-connections']
203 type: int
204 description: Max connections.
205 monitor:
206 type: raw
207 description: (list or str) Monitor.
208 port:
209 type: int
210 description: Port.
211 seq:
212 type: int
213 description: Seq.
214 status:
215 type: str
216 description: Status.
217 choices: ['active', 'standby', 'disable']
218 weight:
219 type: int
220 description: Weight.
221 address:
222 type: str
223 description: Address.
224 id:
225 type: int
226 description: Id.
227 type:
228 type: str
229 description: Type.
230 choices: ['ip', 'address']
231 translate_host:
232 aliases: ['translate-host']
233 type: str
234 description: Enable/disable translation of hostname/IP from virtual server to real server.
235 choices: ['disable', 'enable']
236 health_check_proto:
237 aliases: ['health-check-proto']
238 type: str
239 description: Health check proto.
240 choices: ['ping', 'http']
241 verify_cert:
242 aliases: ['verify-cert']
243 type: str
244 description: Verify cert.
245 choices: ['disable', 'enable']
246 server_type:
247 aliases: ['server-type']
248 type: str
249 description: Server type.
250 choices: ['http', 'https', 'ssl', 'tcp', 'udp', 'ip', 'imaps', 'pop3s', 'smtps',
251 'ssh']
252 service:
253 type: raw
254 description: (list or str) Service.
255 src_filter:
256 aliases: ['src-filter']
257 type: raw
258 description: (list) Src filter.
259 srcintf_filter:
260 aliases: ['srcintf-filter']
261 type: raw
262 description: (list) Srcintf filter.
263 ssl_algorithm:
264 aliases: ['ssl-algorithm']
265 type: str
266 description: Ssl algorithm.
267 choices: ['high', 'medium', 'low', 'custom']
268 ssl_certificate:
269 aliases: ['ssl-certificate']
270 type: str
271 description: Ssl certificate.
272 ssl_cipher_suites:
273 aliases: ['ssl-cipher-suites']
274 type: list
275 elements: dict
276 description: Ssl cipher suites.
277 suboptions:
278 cipher:
279 type: str
280 description: Cipher.
281 choices: ['TLS-RSA-WITH-RC4-128-MD5', 'TLS-RSA-WITH-RC4-128-SHA',
282 'TLS-RSA-WITH-DES-CBC-SHA', 'TLS-RSA-WITH-3DES-EDE-CBC-SHA',
283 'TLS-RSA-WITH-AES-128-CBC-SHA', 'TLS-RSA-WITH-AES-256-CBC-SHA',
284 'TLS-RSA-WITH-AES-128-CBC-SHA256',
285 'TLS-RSA-WITH-AES-256-CBC-SHA256',
286 'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA',
287 'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA',
288 'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256',
289 'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256',
290 'TLS-RSA-WITH-SEED-CBC-SHA', 'TLS-RSA-WITH-ARIA-128-CBC-SHA256',
291 'TLS-RSA-WITH-ARIA-256-CBC-SHA384',
292 'TLS-DHE-RSA-WITH-DES-CBC-SHA',
293 'TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA',
294 'TLS-DHE-RSA-WITH-AES-128-CBC-SHA',
295 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA',
296 'TLS-DHE-RSA-WITH-AES-128-CBC-SHA256',
297 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA256',
298 'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA',
299 'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA',
300 'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256',
301 'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256',
302 'TLS-DHE-RSA-WITH-SEED-CBC-SHA',
303 'TLS-DHE-RSA-WITH-ARIA-128-CBC-SHA256',
304 'TLS-DHE-RSA-WITH-ARIA-256-CBC-SHA384',
305 'TLS-ECDHE-RSA-WITH-RC4-128-SHA',
306 'TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA',
307 'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA',
308 'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA',
309 'TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256',
310 'TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256',
311 'TLS-DHE-RSA-WITH-CHACHA20-POLY1305-SHA256',
312 'TLS-DHE-RSA-WITH-AES-128-GCM-SHA256',
313 'TLS-DHE-RSA-WITH-AES-256-GCM-SHA384',
314 'TLS-DHE-DSS-WITH-AES-128-CBC-SHA',
315 'TLS-DHE-DSS-WITH-AES-256-CBC-SHA',
316 'TLS-DHE-DSS-WITH-AES-128-CBC-SHA256',
317 'TLS-DHE-DSS-WITH-AES-128-GCM-SHA256',
318 'TLS-DHE-DSS-WITH-AES-256-CBC-SHA256',
319 'TLS-DHE-DSS-WITH-AES-256-GCM-SHA384',
320 'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256',
321 'TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256',
322 'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384',
323 'TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384',
324 'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA',
325 'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256',
326 'TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256',
327 'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384',
328 'TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384',
329 'TLS-RSA-WITH-AES-128-GCM-SHA256',
330 'TLS-RSA-WITH-AES-256-GCM-SHA384',
331 'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA',
332 'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA',
333 'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA256',
334 'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA256',
335 'TLS-DHE-DSS-WITH-SEED-CBC-SHA',
336 'TLS-DHE-DSS-WITH-ARIA-128-CBC-SHA256',
337 'TLS-DHE-DSS-WITH-ARIA-256-CBC-SHA384',
338 'TLS-ECDHE-RSA-WITH-ARIA-128-CBC-SHA256',
339 'TLS-ECDHE-RSA-WITH-ARIA-256-CBC-SHA384',
340 'TLS-ECDHE-ECDSA-WITH-ARIA-128-CBC-SHA256',
341 'TLS-ECDHE-ECDSA-WITH-ARIA-256-CBC-SHA384',
342 'TLS-DHE-DSS-WITH-3DES-EDE-CBC-SHA',
343 'TLS-DHE-DSS-WITH-DES-CBC-SHA', 'TLS-AES-128-GCM-SHA256',
344 'TLS-AES-256-GCM-SHA384', 'TLS-CHACHA20-POLY1305-SHA256',
345 'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA']
346 id:
347 type: int
348 description: Id.
349 versions:
350 type: list
351 elements: str
352 description: Versions.
353 choices: ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'tls-1.3']
354 priority:
355 type: int
356 description: Priority.
357 ssl_client_fallback:
358 aliases: ['ssl-client-fallback']
359 type: str
360 description: Ssl client fallback.
361 choices: ['disable', 'enable']
362 ssl_client_renegotiation:
363 aliases: ['ssl-client-renegotiation']
364 type: str
365 description: Ssl client renegotiation.
366 choices: ['deny', 'allow', 'secure']
367 ssl_client_session_state_max:
368 aliases: ['ssl-client-session-state-max']
369 type: int
370 description: Ssl client session state max.
371 ssl_client_session_state_timeout:
372 aliases: ['ssl-client-session-state-timeout']
373 type: int
374 description: Ssl client session state timeout.
375 ssl_client_session_state_type:
376 aliases: ['ssl-client-session-state-type']
377 type: str
378 description: Ssl client session state type.
379 choices: ['disable', 'time', 'count', 'both']
380 ssl_dh_bits:
381 aliases: ['ssl-dh-bits']
382 type: str
383 description: Ssl dh bits.
384 choices: ['768', '1024', '1536', '2048', '3072', '4096']
385 ssl_hpkp:
386 aliases: ['ssl-hpkp']
387 type: str
388 description: Ssl hpkp.
389 choices: ['disable', 'enable', 'report-only']
390 ssl_hpkp_age:
391 aliases: ['ssl-hpkp-age']
392 type: int
393 description: Ssl hpkp age.
394 ssl_hpkp_backup:
395 aliases: ['ssl-hpkp-backup']
396 type: str
397 description: Ssl hpkp backup.
398 ssl_hpkp_include_subdomains:
399 aliases: ['ssl-hpkp-include-subdomains']
400 type: str
401 description: Ssl hpkp include subdomains.
402 choices: ['disable', 'enable']
403 ssl_hpkp_primary:
404 aliases: ['ssl-hpkp-primary']
405 type: str
406 description: Ssl hpkp primary.
407 ssl_hpkp_report_uri:
408 aliases: ['ssl-hpkp-report-uri']
409 type: str
410 description: Ssl hpkp report uri.
411 ssl_hsts:
412 aliases: ['ssl-hsts']
413 type: str
414 description: Ssl hsts.
415 choices: ['disable', 'enable']
416 ssl_hsts_age:
417 aliases: ['ssl-hsts-age']
418 type: int
419 description: Ssl hsts age.
420 ssl_hsts_include_subdomains:
421 aliases: ['ssl-hsts-include-subdomains']
422 type: str
423 description: Ssl hsts include subdomains.
424 choices: ['disable', 'enable']
425 ssl_http_location_conversion:
426 aliases: ['ssl-http-location-conversion']
427 type: str
428 description: Ssl http location conversion.
429 choices: ['disable', 'enable']
430 ssl_http_match_host:
431 aliases: ['ssl-http-match-host']
432 type: str
433 description: Ssl http match host.
434 choices: ['disable', 'enable']
435 ssl_max_version:
436 aliases: ['ssl-max-version']
437 type: str
438 description: Ssl max version.
439 choices: ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'tls-1.3']
440 ssl_min_version:
441 aliases: ['ssl-min-version']
442 type: str
443 description: Ssl min version.
444 choices: ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'tls-1.3']
445 ssl_mode:
446 aliases: ['ssl-mode']
447 type: str
448 description: Ssl mode.
449 choices: ['half', 'full']
450 ssl_pfs:
451 aliases: ['ssl-pfs']
452 type: str
453 description: Ssl pfs.
454 choices: ['require', 'deny', 'allow']
455 ssl_send_empty_frags:
456 aliases: ['ssl-send-empty-frags']
457 type: str
458 description: Ssl send empty frags.
459 choices: ['disable', 'enable']
460 ssl_server_algorithm:
461 aliases: ['ssl-server-algorithm']
462 type: str
463 description: Ssl server algorithm.
464 choices: ['high', 'low', 'medium', 'custom', 'client']
465 ssl_server_max_version:
466 aliases: ['ssl-server-max-version']
467 type: str
468 description: Ssl server max version.
469 choices: ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'client', 'tls-1.3']
470 ssl_server_min_version:
471 aliases: ['ssl-server-min-version']
472 type: str
473 description: Ssl server min version.
474 choices: ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'client', 'tls-1.3']
475 ssl_server_session_state_max:
476 aliases: ['ssl-server-session-state-max']
477 type: int
478 description: Ssl server session state max.
479 ssl_server_session_state_timeout:
480 aliases: ['ssl-server-session-state-timeout']
481 type: int
482 description: Ssl server session state timeout.
483 ssl_server_session_state_type:
484 aliases: ['ssl-server-session-state-type']
485 type: str
486 description: Ssl server session state type.
487 choices: ['disable', 'time', 'count', 'both']
488 type:
489 type: str
490 description: Type.
491 choices: ['static-nat', 'load-balance', 'server-load-balance', 'dns-translation',
492 'fqdn', 'access-proxy']
493 uuid:
494 type: str
495 description: Uuid.
496 weblogic_server:
497 aliases: ['weblogic-server']
498 type: str
499 description: Weblogic server.
500 choices: ['disable', 'enable']
501 websphere_server:
502 aliases: ['websphere-server']
503 type: str
504 description: Websphere server.
505 choices: ['disable', 'enable']
506 http_redirect:
507 aliases: ['http-redirect']
508 type: str
509 description: Http redirect.
510 choices: ['disable', 'enable']
511 ssl_client_rekey_count:
512 aliases: ['ssl-client-rekey-count']
513 type: int
514 description: Ssl client rekey count.
515 status:
516 type: str
517 description: Enable/disable VIP.
518 choices: ['disable', 'enable']
519 add_nat46_route:
520 aliases: ['add-nat46-route']
521 type: str
522 description: Enable/disable adding NAT46 route.
523 choices: ['disable', 'enable']
524 ipv6_mappedip:
525 aliases: ['ipv6-mappedip']
526 type: str
527 description: Range of mapped IPv6 addresses.
528 ipv6_mappedport:
529 aliases: ['ipv6-mappedport']
530 type: str
531 description: IPv6 port number range on the destination network to which the external port number range is mapped.
532 nat44:
533 type: str
534 description: Enable/disable NAT44.
535 choices: ['disable', 'enable']
536 nat46:
537 type: str
538 description: Enable/disable NAT46.
539 choices: ['disable', 'enable']
540 ssl_accept_ffdhe_groups:
541 aliases: ['ssl-accept-ffdhe-groups']
542 type: str
543 description: Enable/disable FFDHE cipher suite for SSL key exchange.
544 choices: ['disable', 'enable']
545 http_multiplex_max_request:
546 aliases: ['http-multiplex-max-request']
547 type: int
548 description: Maximum number of requests that a multiplex server can handle before disconnecting sessions
549 http_multiplex_ttl:
550 aliases: ['http-multiplex-ttl']
551 type: int
552 description: Time-to-live for idle connections to servers.
553 http_supported_max_version:
554 aliases: ['http-supported-max-version']
555 type: str
556 description: Maximum supported HTTP versions.
557 choices: ['http1', 'http2']
558 ssl_server_renegotiation:
559 aliases: ['ssl-server-renegotiation']
560 type: str
561 description: Enable/disable secure renegotiation to comply with RFC 5746.
562 choices: ['disable', 'enable']
563 h2_support:
564 aliases: ['h2-support']
565 type: str
566 description: Enable/disable HTTP2 support
567 choices: ['disable', 'enable']
568 h3_support:
569 aliases: ['h3-support']
570 type: str
571 description: Enable/disable HTTP3/QUIC support
572 choices: ['disable', 'enable']
573 http_multiplex_max_concurrent_request:
574 aliases: ['http-multiplex-max-concurrent-request']
575 type: int
576 description: Maximum number of concurrent requests that a multiplex server can handle
577 gslb_domain_name:
578 aliases: ['gslb-domain-name']
579 type: str
580 description: Domain to use when integrating with FortiGSLB.
581 gslb_hostname:
582 aliases: ['gslb-hostname']
583 type: str
584 description: Hostname to use within the configured FortiGSLB domain.
585 one_click_gslb_server:
586 aliases: ['one-click-gslb-server']
587 type: str
588 description: Enable/disable one click GSLB server integration with FortiGSLB.
589 choices: ['disable', 'enable']
590 src_vip_filter:
591 aliases: ['src-vip-filter']
592 type: str
593 description: Enable/disable use of src-filter to match destinations for the reverse SNAT rule.
594 choices: ['disable', 'enable']
595 client_cert:
596 aliases: ['client-cert']
597 type: str
598 description: Enable/disable requesting client certificate.
599 choices: ['disable', 'enable']
600 empty_cert_action:
601 aliases: ['empty-cert-action']
602 type: str
603 description: Action for an empty client certificate.
604 choices: ['accept', 'block', 'accept-unmanageable']
605 user_agent_detect:
606 aliases: ['user-agent-detect']
607 type: str
608 description: Enable/disable detecting device type by HTTP user-agent if no client certificate is provided.
609 choices: ['disable', 'enable']
610 vip_id:
611 aliases: ['vip-id']
612 type: int
613 description: Vip id.
614 '''
615
616 EXAMPLES = '''
617 - name: Example playbook
618 hosts: fortimanagers
619 gather_facts: false
620 connection: httpapi
621 vars:
622 ansible_httpapi_use_ssl: true
623 ansible_httpapi_validate_certs: false
624 ansible_httpapi_port: 443
625 tasks:
626 - name: Configure dynamic mappings of virtual IP for IPv4
627 fortinet.fortimanager.fmgr_firewall_vip_dynamicmapping:
628 bypass_validation: false
629 adom: ansible
630 vip: "ansible-test-vip" # name
631 state: present
632 firewall_vip_dynamicmapping:
633 _scope: # Required
634 - name: FGT_AWS # need a valid device name
635 vdom: root # need a valid vdom name under the device
636 arp_reply: enable
637 color: 2
638 comment: "ansible-comment"
639 id: 1
640
641 - name: Gathering fortimanager facts
642 hosts: fortimanagers
643 gather_facts: false
644 connection: httpapi
645 vars:
646 ansible_httpapi_use_ssl: true
647 ansible_httpapi_validate_certs: false
648 ansible_httpapi_port: 443
649 tasks:
650 - name: Retrieve all the dynamic mappings of virtual IP for IPv4
651 fortinet.fortimanager.fmgr_fact:
652 facts:
653 selector: "firewall_vip_dynamicmapping"
654 params:
655 adom: "ansible"
656 vip: "ansible-test-vip" # name
657 dynamic_mapping: "your_value"
658 '''
659
660 RETURN = '''
661 meta:
662 description: The result of the request.
663 type: dict
664 returned: always
665 contains:
666 request_url:
667 description: The full url requested.
668 returned: always
669 type: str
670 sample: /sys/login/user
671 response_code:
672 description: The status of api request.
673 returned: always
674 type: int
675 sample: 0
676 response_data:
677 description: The api response.
678 type: list
679 returned: always
680 response_message:
681 description: The descriptive message of the api response.
682 type: str
683 returned: always
684 sample: OK.
685 system_information:
686 description: The information of the target system.
687 type: dict
688 returned: always
689 rc:
690 description: The status the request.
691 type: int
692 returned: always
693 sample: 0
694 version_check_warning:
695 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
696 type: list
697 returned: complex
698 '''
699 from ansible.module_utils.basic import AnsibleModule
700 from ansible.module_utils.connection import Connection
701 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
702 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
703
704
705 def main():
706 urls_list = [
707 '/pm/config/adom/{adom}/obj/firewall/vip/{vip}/dynamic_mapping',
708 '/pm/config/global/obj/firewall/vip/{vip}/dynamic_mapping'
709 ]
710 module_arg_spec = {
711 'adom': {'required': True, 'type': 'str'},
712 'vip': {'required': True, 'type': 'str'},
713 'revision_note': {'type': 'str'},
714 'firewall_vip_dynamicmapping': {
715 'type': 'dict', 'v_range': [['6.0.0', '']],
716 'options': {
717 '_scope': {'type': 'list', 'options': {'name': {'type': 'str'}, 'vdom': {'type': 'str'}}, 'elements': 'dict'},
718 'arp-reply': {'choices': ['disable', 'enable'], 'type': 'str'},
719 'color': {'type': 'int'},
720 'comment': {'type': 'str'},
721 'dns-mapping-ttl': {'type': 'int'},
722 'extaddr': {'type': 'raw'},
723 'extintf': {'type': 'str'},
724 'extip': {'type': 'str'},
725 'extport': {'type': 'str'},
726 'gratuitous-arp-interval': {'type': 'int'},
727 'http-cookie-age': {'type': 'int'},
728 'http-cookie-domain': {'type': 'str'},
729 'http-cookie-domain-from-host': {'choices': ['disable', 'enable'], 'type': 'str'},
730 'http-cookie-generation': {'type': 'int'},
731 'http-cookie-path': {'type': 'str'},
732 'http-cookie-share': {'choices': ['disable', 'same-ip'], 'type': 'str'},
733 'http-ip-header': {'choices': ['disable', 'enable'], 'type': 'str'},
734 'http-ip-header-name': {'type': 'str'},
735 'http-multiplex': {'choices': ['disable', 'enable'], 'type': 'str'},
736 'https-cookie-secure': {'choices': ['disable', 'enable'], 'type': 'str'},
737 'id': {'type': 'int'},
738 'ldb-method': {'choices': ['static', 'round-robin', 'weighted', 'least-session', 'least-rtt', 'first-alive', 'http-host'], 'type': 'str'},
739 'mapped-addr': {'type': 'str'},
740 'mappedip': {'type': 'raw'},
741 'mappedport': {'type': 'str'},
742 'max-embryonic-connections': {'type': 'int'},
743 'monitor': {'type': 'raw'},
744 'nat-source-vip': {'choices': ['disable', 'enable'], 'type': 'str'},
745 'outlook-web-access': {'choices': ['disable', 'enable'], 'type': 'str'},
746 'persistence': {'choices': ['none', 'http-cookie', 'ssl-session-id'], 'type': 'str'},
747 'portforward': {'choices': ['disable', 'enable'], 'type': 'str'},
748 'portmapping-type': {'choices': ['1-to-1', 'm-to-n'], 'type': 'str'},
749 'protocol': {'choices': ['tcp', 'udp', 'sctp', 'icmp'], 'type': 'str'},
750 'realservers': {
751 'type': 'list',
752 'options': {
753 'client-ip': {'type': 'raw'},
754 'healthcheck': {'choices': ['disable', 'enable', 'vip'], 'type': 'str'},
755 'holddown-interval': {'type': 'int'},
756 'http-host': {'type': 'str'},
757 'ip': {'type': 'str'},
758 'max-connections': {'type': 'int'},
759 'monitor': {'type': 'raw'},
760 'port': {'type': 'int'},
761 'seq': {'type': 'int'},
762 'status': {'choices': ['active', 'standby', 'disable'], 'type': 'str'},
763 'weight': {'type': 'int'},
764 'address': {'v_range': [['6.4.0', '']], 'type': 'str'},
765 'id': {'v_range': [['6.4.0', '']], 'type': 'int'},
766 'type': {'v_range': [['6.4.0', '']], 'choices': ['ip', 'address'], 'type': 'str'},
767 'translate-host': {'v_range': [['7.2.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
768 'health-check-proto': {'v_range': [['7.2.3', '']], 'choices': ['ping', 'http'], 'type': 'str'},
769 'verify-cert': {'v_range': [['7.4.7', '7.4.10'], ['7.6.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
770 },
771 'elements': 'dict'
772 },
773 'server-type': {'choices': ['http', 'https', 'ssl', 'tcp', 'udp', 'ip', 'imaps', 'pop3s', 'smtps', 'ssh'], 'type': 'str'},
774 'service': {'type': 'raw'},
775 'src-filter': {'type': 'raw'},
776 'srcintf-filter': {'type': 'raw'},
777 'ssl-algorithm': {'choices': ['high', 'medium', 'low', 'custom'], 'type': 'str'},
778 'ssl-certificate': {'type': 'str'},
779 'ssl-cipher-suites': {
780 'type': 'list',
781 'options': {
782 'cipher': {
783 'choices': [
784 'TLS-RSA-WITH-RC4-128-MD5', 'TLS-RSA-WITH-RC4-128-SHA', 'TLS-RSA-WITH-DES-CBC-SHA', 'TLS-RSA-WITH-3DES-EDE-CBC-SHA',
785 'TLS-RSA-WITH-AES-128-CBC-SHA', 'TLS-RSA-WITH-AES-256-CBC-SHA', 'TLS-RSA-WITH-AES-128-CBC-SHA256',
786 'TLS-RSA-WITH-AES-256-CBC-SHA256', 'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA', 'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA',
787 'TLS-RSA-WITH-CAMELLIA-128-CBC-SHA256', 'TLS-RSA-WITH-CAMELLIA-256-CBC-SHA256', 'TLS-RSA-WITH-SEED-CBC-SHA',
788 'TLS-RSA-WITH-ARIA-128-CBC-SHA256', 'TLS-RSA-WITH-ARIA-256-CBC-SHA384', 'TLS-DHE-RSA-WITH-DES-CBC-SHA',
789 'TLS-DHE-RSA-WITH-3DES-EDE-CBC-SHA', 'TLS-DHE-RSA-WITH-AES-128-CBC-SHA', 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA',
790 'TLS-DHE-RSA-WITH-AES-128-CBC-SHA256', 'TLS-DHE-RSA-WITH-AES-256-CBC-SHA256', 'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA',
791 'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA', 'TLS-DHE-RSA-WITH-CAMELLIA-128-CBC-SHA256',
792 'TLS-DHE-RSA-WITH-CAMELLIA-256-CBC-SHA256', 'TLS-DHE-RSA-WITH-SEED-CBC-SHA', 'TLS-DHE-RSA-WITH-ARIA-128-CBC-SHA256',
793 'TLS-DHE-RSA-WITH-ARIA-256-CBC-SHA384', 'TLS-ECDHE-RSA-WITH-RC4-128-SHA', 'TLS-ECDHE-RSA-WITH-3DES-EDE-CBC-SHA',
794 'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA', 'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA',
795 'TLS-ECDHE-RSA-WITH-CHACHA20-POLY1305-SHA256', 'TLS-ECDHE-ECDSA-WITH-CHACHA20-POLY1305-SHA256',
796 'TLS-DHE-RSA-WITH-CHACHA20-POLY1305-SHA256', 'TLS-DHE-RSA-WITH-AES-128-GCM-SHA256',
797 'TLS-DHE-RSA-WITH-AES-256-GCM-SHA384', 'TLS-DHE-DSS-WITH-AES-128-CBC-SHA', 'TLS-DHE-DSS-WITH-AES-256-CBC-SHA',
798 'TLS-DHE-DSS-WITH-AES-128-CBC-SHA256', 'TLS-DHE-DSS-WITH-AES-128-GCM-SHA256', 'TLS-DHE-DSS-WITH-AES-256-CBC-SHA256',
799 'TLS-DHE-DSS-WITH-AES-256-GCM-SHA384', 'TLS-ECDHE-RSA-WITH-AES-128-CBC-SHA256', 'TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256',
800 'TLS-ECDHE-RSA-WITH-AES-256-CBC-SHA384', 'TLS-ECDHE-RSA-WITH-AES-256-GCM-SHA384', 'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA',
801 'TLS-ECDHE-ECDSA-WITH-AES-128-CBC-SHA256', 'TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256',
802 'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA384', 'TLS-ECDHE-ECDSA-WITH-AES-256-GCM-SHA384', 'TLS-RSA-WITH-AES-128-GCM-SHA256',
803 'TLS-RSA-WITH-AES-256-GCM-SHA384', 'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA', 'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA',
804 'TLS-DHE-DSS-WITH-CAMELLIA-128-CBC-SHA256', 'TLS-DHE-DSS-WITH-CAMELLIA-256-CBC-SHA256', 'TLS-DHE-DSS-WITH-SEED-CBC-SHA',
805 'TLS-DHE-DSS-WITH-ARIA-128-CBC-SHA256', 'TLS-DHE-DSS-WITH-ARIA-256-CBC-SHA384', 'TLS-ECDHE-RSA-WITH-ARIA-128-CBC-SHA256',
806 'TLS-ECDHE-RSA-WITH-ARIA-256-CBC-SHA384', 'TLS-ECDHE-ECDSA-WITH-ARIA-128-CBC-SHA256',
807 'TLS-ECDHE-ECDSA-WITH-ARIA-256-CBC-SHA384', 'TLS-DHE-DSS-WITH-3DES-EDE-CBC-SHA', 'TLS-DHE-DSS-WITH-DES-CBC-SHA',
808 'TLS-AES-128-GCM-SHA256', 'TLS-AES-256-GCM-SHA384', 'TLS-CHACHA20-POLY1305-SHA256',
809 'TLS-ECDHE-ECDSA-WITH-AES-256-CBC-SHA'
810 ],
811 'type': 'str'
812 },
813 'id': {'type': 'int'},
814 'versions': {'type': 'list', 'choices': ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'tls-1.3'], 'elements': 'str'},
815 'priority': {'v_range': [['6.4.0', '']], 'type': 'int'}
816 },
817 'elements': 'dict'
818 },
819 'ssl-client-fallback': {'choices': ['disable', 'enable'], 'type': 'str'},
820 'ssl-client-renegotiation': {'choices': ['deny', 'allow', 'secure'], 'type': 'str'},
821 'ssl-client-session-state-max': {'type': 'int'},
822 'ssl-client-session-state-timeout': {'type': 'int'},
823 'ssl-client-session-state-type': {'choices': ['disable', 'time', 'count', 'both'], 'type': 'str'},
824 'ssl-dh-bits': {'choices': ['768', '1024', '1536', '2048', '3072', '4096'], 'type': 'str'},
825 'ssl-hpkp': {'choices': ['disable', 'enable', 'report-only'], 'type': 'str'},
826 'ssl-hpkp-age': {'type': 'int'},
827 'ssl-hpkp-backup': {'type': 'str'},
828 'ssl-hpkp-include-subdomains': {'choices': ['disable', 'enable'], 'type': 'str'},
829 'ssl-hpkp-primary': {'type': 'str'},
830 'ssl-hpkp-report-uri': {'type': 'str'},
831 'ssl-hsts': {'choices': ['disable', 'enable'], 'type': 'str'},
832 'ssl-hsts-age': {'type': 'int'},
833 'ssl-hsts-include-subdomains': {'choices': ['disable', 'enable'], 'type': 'str'},
834 'ssl-http-location-conversion': {'choices': ['disable', 'enable'], 'type': 'str'},
835 'ssl-http-match-host': {'choices': ['disable', 'enable'], 'type': 'str'},
836 'ssl-max-version': {'choices': ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'tls-1.3'], 'type': 'str'},
837 'ssl-min-version': {'choices': ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'tls-1.3'], 'type': 'str'},
838 'ssl-mode': {'choices': ['half', 'full'], 'type': 'str'},
839 'ssl-pfs': {'choices': ['require', 'deny', 'allow'], 'type': 'str'},
840 'ssl-send-empty-frags': {'choices': ['disable', 'enable'], 'type': 'str'},
841 'ssl-server-algorithm': {'choices': ['high', 'low', 'medium', 'custom', 'client'], 'type': 'str'},
842 'ssl-server-max-version': {'choices': ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'client', 'tls-1.3'], 'type': 'str'},
843 'ssl-server-min-version': {'choices': ['ssl-3.0', 'tls-1.0', 'tls-1.1', 'tls-1.2', 'client', 'tls-1.3'], 'type': 'str'},
844 'ssl-server-session-state-max': {'type': 'int'},
845 'ssl-server-session-state-timeout': {'type': 'int'},
846 'ssl-server-session-state-type': {'choices': ['disable', 'time', 'count', 'both'], 'type': 'str'},
847 'type': {'choices': ['static-nat', 'load-balance', 'server-load-balance', 'dns-translation', 'fqdn', 'access-proxy'], 'type': 'str'},
848 'uuid': {'type': 'str'},
849 'weblogic-server': {'choices': ['disable', 'enable'], 'type': 'str'},
850 'websphere-server': {'choices': ['disable', 'enable'], 'type': 'str'},
851 'http-redirect': {'v_range': [['6.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
852 'ssl-client-rekey-count': {'v_range': [['6.2.1', '']], 'no_log': True, 'type': 'int'},
853 'status': {'v_range': [['7.0.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
854 'add-nat46-route': {'v_range': [['7.0.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
855 'ipv6-mappedip': {'v_range': [['7.0.1', '']], 'type': 'str'},
856 'ipv6-mappedport': {'v_range': [['7.0.1', '']], 'type': 'str'},
857 'nat44': {'v_range': [['7.0.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
858 'nat46': {'v_range': [['7.0.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
859 'ssl-accept-ffdhe-groups': {'v_range': [['7.0.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
860 'http-multiplex-max-request': {'v_range': [['7.2.2', '']], 'type': 'int'},
861 'http-multiplex-ttl': {'v_range': [['7.2.2', '']], 'type': 'int'},
862 'http-supported-max-version': {'v_range': [['7.2.2', '']], 'choices': ['http1', 'http2'], 'type': 'str'},
863 'ssl-server-renegotiation': {'v_range': [['7.2.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
864 'h2-support': {'v_range': [['7.4.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
865 'h3-support': {'v_range': [['7.4.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
866 'http-multiplex-max-concurrent-request': {'v_range': [['7.4.1', '']], 'type': 'int'},
867 'gslb-domain-name': {'v_range': [['7.4.2', '']], 'type': 'str'},
868 'gslb-hostname': {'v_range': [['7.4.2', '']], 'type': 'str'},
869 'one-click-gslb-server': {'v_range': [['7.4.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
870 'src-vip-filter': {'v_range': [['7.4.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
871 'client-cert': {'v_range': [['7.6.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
872 'empty-cert-action': {'v_range': [['7.6.2', '']], 'choices': ['accept', 'block', 'accept-unmanageable'], 'type': 'str'},
873 'user-agent-detect': {'v_range': [['7.6.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
874 'vip-id': {'v_range': [['7.6.5', '']], 'type': 'int'}
875 }
876 }
877 }
878
879 module_option_spec = get_module_arg_spec('full crud')
880 module_arg_spec.update(module_option_spec)
881 check_galaxy_version(module_arg_spec)
882 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_vip_dynamicmapping'),
883 supports_check_mode=True)
884 if not module._socket_path:
885 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
886 connection = Connection(module._socket_path)
887 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
888 'complex:{{module}}["_scope"][0]["name"]+"/"+{{module}}["_scope"][0]["vdom"]', 'data', module, connection)
889 fmgr.process_crud()
890 module.exit_json(meta=module.params)
891
892
893 if __name__ == '__main__':
894 main()