| 1 |
|
| 2 |
from __future__ import absolute_import, division, print_function |
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 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_policy6 |
| 23 |
short_description: Configure IPv6 policies 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 policy6 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 |
- We highly recommend using your own value as the policyid instead of 0, while '0' is a special placeholder that allows the backend to assign the latest |
| 39 |
available number for the object, it does have limitations. Please find more details in Q&A. |
| 40 |
- Legacy fortiosapi has been deprecated, httpapi is the preferred way to run playbooks |
| 41 |
|
| 42 |
- The module supports check_mode. |
| 43 |
|
| 44 |
requirements: |
| 45 |
- ansible>=2.16 |
| 46 |
options: |
| 47 |
access_token: |
| 48 |
description: |
| 49 |
- Token-based authentication. |
| 50 |
Generated from GUI of Fortigate. |
| 51 |
type: str |
| 52 |
required: false |
| 53 |
enable_log: |
| 54 |
description: |
| 55 |
- Enable/Disable logging for task. |
| 56 |
type: bool |
| 57 |
required: false |
| 58 |
default: false |
| 59 |
vdom: |
| 60 |
description: |
| 61 |
- Virtual domain, among those defined previously. A vdom is a |
| 62 |
virtual instance of the FortiGate that can be configured and |
| 63 |
used as a different unit. |
| 64 |
type: str |
| 65 |
default: root |
| 66 |
member_path: |
| 67 |
type: str |
| 68 |
description: |
| 69 |
- Member attribute path to operate on. |
| 70 |
- Delimited by a slash character if there are more than one attribute. |
| 71 |
- Parameter marked with member_path is legitimate for doing member operation. |
| 72 |
member_state: |
| 73 |
type: str |
| 74 |
description: |
| 75 |
- Add or delete a member under specified attribute path. |
| 76 |
- When member_state is specified, the state option is ignored. |
| 77 |
choices: |
| 78 |
- 'present' |
| 79 |
- 'absent' |
| 80 |
|
| 81 |
state: |
| 82 |
description: |
| 83 |
- Indicates whether to create or remove the object. |
| 84 |
type: str |
| 85 |
required: true |
| 86 |
choices: |
| 87 |
- 'present' |
| 88 |
- 'absent' |
| 89 |
firewall_policy6: |
| 90 |
description: |
| 91 |
- Configure IPv6 policies. |
| 92 |
default: null |
| 93 |
type: dict |
| 94 |
suboptions: |
| 95 |
action: |
| 96 |
description: |
| 97 |
- Policy action (allow/deny/ipsec). |
| 98 |
type: str |
| 99 |
choices: |
| 100 |
- 'accept' |
| 101 |
- 'deny' |
| 102 |
- 'ipsec' |
| 103 |
anti_replay: |
| 104 |
description: |
| 105 |
- Enable/disable anti-replay check. |
| 106 |
type: str |
| 107 |
choices: |
| 108 |
- 'enable' |
| 109 |
- 'disable' |
| 110 |
app_category: |
| 111 |
description: |
| 112 |
- Application category ID list. |
| 113 |
type: list |
| 114 |
elements: dict |
| 115 |
suboptions: |
| 116 |
id: |
| 117 |
description: |
| 118 |
- Category IDs. see <a href='#notes'>Notes</a>. |
| 119 |
required: true |
| 120 |
type: int |
| 121 |
app_group: |
| 122 |
description: |
| 123 |
- Application group names. |
| 124 |
type: list |
| 125 |
elements: dict |
| 126 |
suboptions: |
| 127 |
name: |
| 128 |
description: |
| 129 |
- Application group names. Source application.group.name. |
| 130 |
required: true |
| 131 |
type: str |
| 132 |
application: |
| 133 |
description: |
| 134 |
- Application ID list. |
| 135 |
type: list |
| 136 |
elements: dict |
| 137 |
suboptions: |
| 138 |
id: |
| 139 |
description: |
| 140 |
- Application IDs. see <a href='#notes'>Notes</a>. |
| 141 |
required: true |
| 142 |
type: int |
| 143 |
application_list: |
| 144 |
description: |
| 145 |
- Name of an existing Application list. Source application.list.name. |
| 146 |
type: str |
| 147 |
auto_asic_offload: |
| 148 |
description: |
| 149 |
- Enable/disable policy traffic ASIC offloading. |
| 150 |
type: str |
| 151 |
choices: |
| 152 |
- 'enable' |
| 153 |
- 'disable' |
| 154 |
av_profile: |
| 155 |
description: |
| 156 |
- Name of an existing Antivirus profile. Source antivirus.profile.name. |
| 157 |
type: str |
| 158 |
cifs_profile: |
| 159 |
description: |
| 160 |
- Name of an existing CIFS profile. Source cifs.profile.name. |
| 161 |
type: str |
| 162 |
comments: |
| 163 |
description: |
| 164 |
- Comment. |
| 165 |
type: str |
| 166 |
custom_log_fields: |
| 167 |
description: |
| 168 |
- Log field index numbers to append custom log fields to log messages for this policy. |
| 169 |
type: list |
| 170 |
elements: dict |
| 171 |
suboptions: |
| 172 |
field_id: |
| 173 |
description: |
| 174 |
- Custom log field. Source log.custom-field.id. |
| 175 |
required: true |
| 176 |
type: str |
| 177 |
devices: |
| 178 |
description: |
| 179 |
- Names of devices or device groups that can be matched by the policy. |
| 180 |
type: list |
| 181 |
elements: dict |
| 182 |
suboptions: |
| 183 |
name: |
| 184 |
description: |
| 185 |
- Device or group name. Source user.device.alias user.device-group.name user.device-category.name. |
| 186 |
required: true |
| 187 |
type: str |
| 188 |
diffserv_forward: |
| 189 |
description: |
| 190 |
- Enable to change packet"s DiffServ values to the specified diffservcode-forward value. |
| 191 |
type: str |
| 192 |
choices: |
| 193 |
- 'enable' |
| 194 |
- 'disable' |
| 195 |
diffserv_reverse: |
| 196 |
description: |
| 197 |
- Enable to change packet"s reverse (reply) DiffServ values to the specified diffservcode-rev value. |
| 198 |
type: str |
| 199 |
choices: |
| 200 |
- 'enable' |
| 201 |
- 'disable' |
| 202 |
diffservcode_forward: |
| 203 |
description: |
| 204 |
- Change packet"s DiffServ to this value. |
| 205 |
type: str |
| 206 |
diffservcode_rev: |
| 207 |
description: |
| 208 |
- Change packet"s reverse (reply) DiffServ to this value. |
| 209 |
type: str |
| 210 |
dlp_sensor: |
| 211 |
description: |
| 212 |
- Name of an existing DLP sensor. Source dlp.sensor.name. |
| 213 |
type: str |
| 214 |
dnsfilter_profile: |
| 215 |
description: |
| 216 |
- Name of an existing DNS filter profile. Source dnsfilter.profile.name. |
| 217 |
type: str |
| 218 |
dscp_match: |
| 219 |
description: |
| 220 |
- Enable DSCP check. |
| 221 |
type: str |
| 222 |
choices: |
| 223 |
- 'enable' |
| 224 |
- 'disable' |
| 225 |
dscp_negate: |
| 226 |
description: |
| 227 |
- Enable negated DSCP match. |
| 228 |
type: str |
| 229 |
choices: |
| 230 |
- 'enable' |
| 231 |
- 'disable' |
| 232 |
dscp_value: |
| 233 |
description: |
| 234 |
- DSCP value. |
| 235 |
type: str |
| 236 |
dsri: |
| 237 |
description: |
| 238 |
- Enable DSRI to ignore HTTP server responses. |
| 239 |
type: str |
| 240 |
choices: |
| 241 |
- 'enable' |
| 242 |
- 'disable' |
| 243 |
dstaddr: |
| 244 |
description: |
| 245 |
- Destination address and address group names. |
| 246 |
type: list |
| 247 |
elements: dict |
| 248 |
suboptions: |
| 249 |
name: |
| 250 |
description: |
| 251 |
- Address name. Source firewall.address6.name firewall.addrgrp6.name firewall.vip6.name firewall.vipgrp6.name system |
| 252 |
.external-resource.name. |
| 253 |
required: true |
| 254 |
type: str |
| 255 |
dstaddr_negate: |
| 256 |
description: |
| 257 |
- When enabled dstaddr specifies what the destination address must NOT be. |
| 258 |
type: str |
| 259 |
choices: |
| 260 |
- 'enable' |
| 261 |
- 'disable' |
| 262 |
dstintf: |
| 263 |
description: |
| 264 |
- Outgoing (egress) interface. |
| 265 |
type: list |
| 266 |
elements: dict |
| 267 |
suboptions: |
| 268 |
name: |
| 269 |
description: |
| 270 |
- Interface name. Source system.interface.name system.zone.name. |
| 271 |
required: true |
| 272 |
type: str |
| 273 |
emailfilter_profile: |
| 274 |
description: |
| 275 |
- Name of an existing email filter profile. Source emailfilter.profile.name. |
| 276 |
type: str |
| 277 |
firewall_session_dirty: |
| 278 |
description: |
| 279 |
- How to handle sessions if the configuration of this firewall policy changes. |
| 280 |
type: str |
| 281 |
choices: |
| 282 |
- 'check-all' |
| 283 |
- 'check-new' |
| 284 |
fixedport: |
| 285 |
description: |
| 286 |
- Enable to prevent source NAT from changing a session"s source port. |
| 287 |
type: str |
| 288 |
choices: |
| 289 |
- 'enable' |
| 290 |
- 'disable' |
| 291 |
fsso_groups: |
| 292 |
description: |
| 293 |
- Names of FSSO groups. |
| 294 |
type: list |
| 295 |
elements: dict |
| 296 |
suboptions: |
| 297 |
name: |
| 298 |
description: |
| 299 |
- Names of FSSO groups. Source user.adgrp.name. |
| 300 |
required: true |
| 301 |
type: str |
| 302 |
global_label: |
| 303 |
description: |
| 304 |
- Label for the policy that appears when the GUI is in Global View mode. |
| 305 |
type: str |
| 306 |
groups: |
| 307 |
description: |
| 308 |
- Names of user groups that can authenticate with this policy. |
| 309 |
type: list |
| 310 |
elements: dict |
| 311 |
suboptions: |
| 312 |
name: |
| 313 |
description: |
| 314 |
- Group name. Source user.group.name. |
| 315 |
required: true |
| 316 |
type: str |
| 317 |
http_policy_redirect: |
| 318 |
description: |
| 319 |
- Redirect HTTP(S) traffic to matching transparent web proxy policy. |
| 320 |
type: str |
| 321 |
choices: |
| 322 |
- 'enable' |
| 323 |
- 'disable' |
| 324 |
icap_profile: |
| 325 |
description: |
| 326 |
- Name of an existing ICAP profile. Source icap.profile.name. |
| 327 |
type: str |
| 328 |
inbound: |
| 329 |
description: |
| 330 |
- 'Policy-based IPsec VPN: only traffic from the remote network can initiate a VPN.' |
| 331 |
type: str |
| 332 |
choices: |
| 333 |
- 'enable' |
| 334 |
- 'disable' |
| 335 |
inspection_mode: |
| 336 |
description: |
| 337 |
- Policy inspection mode (Flow/proxy). Default is Flow mode. |
| 338 |
type: str |
| 339 |
choices: |
| 340 |
- 'proxy' |
| 341 |
- 'flow' |
| 342 |
ippool: |
| 343 |
description: |
| 344 |
- Enable to use IP Pools for source NAT. |
| 345 |
type: str |
| 346 |
choices: |
| 347 |
- 'enable' |
| 348 |
- 'disable' |
| 349 |
ips_sensor: |
| 350 |
description: |
| 351 |
- Name of an existing IPS sensor. Source ips.sensor.name. |
| 352 |
type: str |
| 353 |
label: |
| 354 |
description: |
| 355 |
- Label for the policy that appears when the GUI is in Section View mode. |
| 356 |
type: str |
| 357 |
logtraffic: |
| 358 |
description: |
| 359 |
- Enable or disable logging. Log all sessions or security profile sessions. |
| 360 |
type: str |
| 361 |
choices: |
| 362 |
- 'all' |
| 363 |
- 'utm' |
| 364 |
- 'disable' |
| 365 |
logtraffic_start: |
| 366 |
description: |
| 367 |
- Record logs when a session starts. |
| 368 |
type: str |
| 369 |
choices: |
| 370 |
- 'enable' |
| 371 |
- 'disable' |
| 372 |
mms_profile: |
| 373 |
description: |
| 374 |
- Name of an existing MMS profile. Source firewall.mms-profile.name. |
| 375 |
type: str |
| 376 |
name: |
| 377 |
description: |
| 378 |
- Policy name. |
| 379 |
type: str |
| 380 |
nat: |
| 381 |
description: |
| 382 |
- Enable/disable source NAT. |
| 383 |
type: str |
| 384 |
choices: |
| 385 |
- 'enable' |
| 386 |
- 'disable' |
| 387 |
natinbound: |
| 388 |
description: |
| 389 |
- 'Policy-based IPsec VPN: apply destination NAT to inbound traffic.' |
| 390 |
type: str |
| 391 |
choices: |
| 392 |
- 'enable' |
| 393 |
- 'disable' |
| 394 |
natoutbound: |
| 395 |
description: |
| 396 |
- 'Policy-based IPsec VPN: apply source NAT to outbound traffic.' |
| 397 |
type: str |
| 398 |
choices: |
| 399 |
- 'enable' |
| 400 |
- 'disable' |
| 401 |
np_acceleration: |
| 402 |
description: |
| 403 |
- Enable/disable UTM Network Processor acceleration. |
| 404 |
type: str |
| 405 |
choices: |
| 406 |
- 'enable' |
| 407 |
- 'disable' |
| 408 |
outbound: |
| 409 |
description: |
| 410 |
- 'Policy-based IPsec VPN: only traffic from the internal network can initiate a VPN.' |
| 411 |
type: str |
| 412 |
choices: |
| 413 |
- 'enable' |
| 414 |
- 'disable' |
| 415 |
per_ip_shaper: |
| 416 |
description: |
| 417 |
- Per-IP traffic shaper. Source firewall.shaper.per-ip-shaper.name. |
| 418 |
type: str |
| 419 |
policyid: |
| 420 |
description: |
| 421 |
- Policy ID (0 - 4294967294). see <a href='#notes'>Notes</a>. |
| 422 |
required: true |
| 423 |
type: int |
| 424 |
poolname: |
| 425 |
description: |
| 426 |
- IP Pool names. |
| 427 |
type: list |
| 428 |
elements: dict |
| 429 |
suboptions: |
| 430 |
name: |
| 431 |
description: |
| 432 |
- IP pool name. Source firewall.ippool6.name. |
| 433 |
required: true |
| 434 |
type: str |
| 435 |
profile_group: |
| 436 |
description: |
| 437 |
- Name of profile group. Source firewall.profile-group.name. |
| 438 |
type: str |
| 439 |
profile_protocol_options: |
| 440 |
description: |
| 441 |
- Name of an existing Protocol options profile. Source firewall.profile-protocol-options.name. |
| 442 |
type: str |
| 443 |
profile_type: |
| 444 |
description: |
| 445 |
- Determine whether the firewall policy allows security profile groups or single profiles only. |
| 446 |
type: str |
| 447 |
choices: |
| 448 |
- 'single' |
| 449 |
- 'group' |
| 450 |
replacemsg_override_group: |
| 451 |
description: |
| 452 |
- Override the default replacement message group for this policy. Source system.replacemsg-group.name. |
| 453 |
type: str |
| 454 |
rsso: |
| 455 |
description: |
| 456 |
- Enable/disable RADIUS single sign-on (RSSO). |
| 457 |
type: str |
| 458 |
choices: |
| 459 |
- 'enable' |
| 460 |
- 'disable' |
| 461 |
schedule: |
| 462 |
description: |
| 463 |
- Schedule name. Source firewall.schedule.onetime.name firewall.schedule.recurring.name firewall.schedule.group.name. |
| 464 |
type: str |
| 465 |
send_deny_packet: |
| 466 |
description: |
| 467 |
- Enable/disable return of deny-packet. |
| 468 |
type: str |
| 469 |
choices: |
| 470 |
- 'enable' |
| 471 |
- 'disable' |
| 472 |
service: |
| 473 |
description: |
| 474 |
- Service and service group names. |
| 475 |
type: list |
| 476 |
elements: dict |
| 477 |
suboptions: |
| 478 |
name: |
| 479 |
description: |
| 480 |
- Address name. Source firewall.service.custom.name firewall.service.group.name. |
| 481 |
required: true |
| 482 |
type: str |
| 483 |
service_negate: |
| 484 |
description: |
| 485 |
- When enabled service specifies what the service must NOT be. |
| 486 |
type: str |
| 487 |
choices: |
| 488 |
- 'enable' |
| 489 |
- 'disable' |
| 490 |
session_ttl: |
| 491 |
description: |
| 492 |
- Session TTL in seconds for sessions accepted by this policy. 0 means use the system default session TTL. |
| 493 |
type: str |
| 494 |
spamfilter_profile: |
| 495 |
description: |
| 496 |
- Name of an existing Spam filter profile. Source spamfilter.profile.name. |
| 497 |
type: str |
| 498 |
srcaddr: |
| 499 |
description: |
| 500 |
- Source address and address group names. |
| 501 |
type: list |
| 502 |
elements: dict |
| 503 |
suboptions: |
| 504 |
name: |
| 505 |
description: |
| 506 |
- Address name. Source firewall.address6.name firewall.addrgrp6.name system.external-resource.name. |
| 507 |
required: true |
| 508 |
type: str |
| 509 |
srcaddr_negate: |
| 510 |
description: |
| 511 |
- When enabled srcaddr specifies what the source address must NOT be. |
| 512 |
type: str |
| 513 |
choices: |
| 514 |
- 'enable' |
| 515 |
- 'disable' |
| 516 |
srcintf: |
| 517 |
description: |
| 518 |
- Incoming (ingress) interface. |
| 519 |
type: list |
| 520 |
elements: dict |
| 521 |
suboptions: |
| 522 |
name: |
| 523 |
description: |
| 524 |
- Interface name. Source system.zone.name system.interface.name. |
| 525 |
required: true |
| 526 |
type: str |
| 527 |
ssh_filter_profile: |
| 528 |
description: |
| 529 |
- Name of an existing SSH filter profile. Source ssh-filter.profile.name. |
| 530 |
type: str |
| 531 |
ssh_policy_redirect: |
| 532 |
description: |
| 533 |
- Redirect SSH traffic to matching transparent proxy policy. |
| 534 |
type: str |
| 535 |
choices: |
| 536 |
- 'enable' |
| 537 |
- 'disable' |
| 538 |
ssl_mirror: |
| 539 |
description: |
| 540 |
- Enable to copy decrypted SSL traffic to a FortiGate interface (called SSL mirroring). |
| 541 |
type: str |
| 542 |
choices: |
| 543 |
- 'enable' |
| 544 |
- 'disable' |
| 545 |
ssl_mirror_intf: |
| 546 |
description: |
| 547 |
- SSL mirror interface name. |
| 548 |
type: list |
| 549 |
elements: dict |
| 550 |
suboptions: |
| 551 |
name: |
| 552 |
description: |
| 553 |
- Interface name. Source system.zone.name system.interface.name. |
| 554 |
required: true |
| 555 |
type: str |
| 556 |
ssl_ssh_profile: |
| 557 |
description: |
| 558 |
- Name of an existing SSL SSH profile. Source firewall.ssl-ssh-profile.name. |
| 559 |
type: str |
| 560 |
status: |
| 561 |
description: |
| 562 |
- Enable or disable this policy. |
| 563 |
type: str |
| 564 |
choices: |
| 565 |
- 'enable' |
| 566 |
- 'disable' |
| 567 |
tcp_mss_receiver: |
| 568 |
description: |
| 569 |
- Receiver TCP maximum segment size (MSS). |
| 570 |
type: int |
| 571 |
tcp_mss_sender: |
| 572 |
description: |
| 573 |
- Sender TCP maximum segment size (MSS). |
| 574 |
type: int |
| 575 |
tcp_session_without_syn: |
| 576 |
description: |
| 577 |
- Enable/disable creation of TCP session without SYN flag. |
| 578 |
type: str |
| 579 |
choices: |
| 580 |
- 'all' |
| 581 |
- 'data-only' |
| 582 |
- 'disable' |
| 583 |
timeout_send_rst: |
| 584 |
description: |
| 585 |
- Enable/disable sending RST packets when TCP sessions expire. |
| 586 |
type: str |
| 587 |
choices: |
| 588 |
- 'enable' |
| 589 |
- 'disable' |
| 590 |
tos: |
| 591 |
description: |
| 592 |
- ToS (Type of Service) value used for comparison. |
| 593 |
type: str |
| 594 |
tos_mask: |
| 595 |
description: |
| 596 |
- Non-zero bit positions are used for comparison while zero bit positions are ignored. |
| 597 |
type: str |
| 598 |
tos_negate: |
| 599 |
description: |
| 600 |
- Enable negated TOS match. |
| 601 |
type: str |
| 602 |
choices: |
| 603 |
- 'enable' |
| 604 |
- 'disable' |
| 605 |
traffic_shaper: |
| 606 |
description: |
| 607 |
- Reverse traffic shaper. Source firewall.shaper.traffic-shaper.name. |
| 608 |
type: str |
| 609 |
traffic_shaper_reverse: |
| 610 |
description: |
| 611 |
- Reverse traffic shaper. Source firewall.shaper.traffic-shaper.name. |
| 612 |
type: str |
| 613 |
url_category: |
| 614 |
description: |
| 615 |
- URL category ID list. |
| 616 |
type: list |
| 617 |
elements: dict |
| 618 |
suboptions: |
| 619 |
id: |
| 620 |
description: |
| 621 |
- URL category ID. see <a href='#notes'>Notes</a>. |
| 622 |
required: true |
| 623 |
type: int |
| 624 |
users: |
| 625 |
description: |
| 626 |
- Names of individual users that can authenticate with this policy. |
| 627 |
type: list |
| 628 |
elements: dict |
| 629 |
suboptions: |
| 630 |
name: |
| 631 |
description: |
| 632 |
- Names of individual users that can authenticate with this policy. Source user.local.name. |
| 633 |
required: true |
| 634 |
type: str |
| 635 |
utm_status: |
| 636 |
description: |
| 637 |
- Enable AV/web/ips protection profile. |
| 638 |
type: str |
| 639 |
choices: |
| 640 |
- 'enable' |
| 641 |
- 'disable' |
| 642 |
uuid: |
| 643 |
description: |
| 644 |
- Universally Unique Identifier (UUID; automatically assigned but can be manually reset). |
| 645 |
type: str |
| 646 |
vlan_cos_fwd: |
| 647 |
description: |
| 648 |
- 'VLAN forward direction user priority: 255 passthrough, 0 lowest, 7 highest' |
| 649 |
type: int |
| 650 |
vlan_cos_rev: |
| 651 |
description: |
| 652 |
- 'VLAN reverse direction user priority: 255 passthrough, 0 lowest, 7 highest' |
| 653 |
type: int |
| 654 |
vlan_filter: |
| 655 |
description: |
| 656 |
- Set VLAN filters. |
| 657 |
type: str |
| 658 |
voip_profile: |
| 659 |
description: |
| 660 |
- Name of an existing VoIP profile. Source voip.profile.name. |
| 661 |
type: str |
| 662 |
vpntunnel: |
| 663 |
description: |
| 664 |
- 'Policy-based IPsec VPN: name of the IPsec VPN Phase 1. Source vpn.ipsec.phase1.name vpn.ipsec.manualkey.name.' |
| 665 |
type: str |
| 666 |
waf_profile: |
| 667 |
description: |
| 668 |
- Name of an existing Web application firewall profile. Source waf.profile.name. |
| 669 |
type: str |
| 670 |
webcache: |
| 671 |
description: |
| 672 |
- Enable/disable web cache. |
| 673 |
type: str |
| 674 |
choices: |
| 675 |
- 'enable' |
| 676 |
- 'disable' |
| 677 |
webcache_https: |
| 678 |
description: |
| 679 |
- Enable/disable web cache for HTTPS. |
| 680 |
type: str |
| 681 |
choices: |
| 682 |
- 'disable' |
| 683 |
- 'enable' |
| 684 |
webfilter_profile: |
| 685 |
description: |
| 686 |
- Name of an existing Web filter profile. Source webfilter.profile.name. |
| 687 |
type: str |
| 688 |
webproxy_forward_server: |
| 689 |
description: |
| 690 |
- Web proxy forward server name. Source web-proxy.forward-server.name web-proxy.forward-server-group.name. |
| 691 |
type: str |
| 692 |
webproxy_profile: |
| 693 |
description: |
| 694 |
- Webproxy profile name. Source web-proxy.profile.name. |
| 695 |
type: str |
| 696 |
""" |
| 697 |
|
| 698 |
EXAMPLES = """ |
| 699 |
- name: Configure IPv6 policies. |
| 700 |
fortinet.fortios.fortios_firewall_policy6: |
| 701 |
vdom: "{{ vdom }}" |
| 702 |
state: "present" |
| 703 |
access_token: "<your_own_value>" |
| 704 |
firewall_policy6: |
| 705 |
action: "accept" |
| 706 |
anti_replay: "enable" |
| 707 |
app_category: |
| 708 |
- |
| 709 |
id: "6" |
| 710 |
app_group: |
| 711 |
- |
| 712 |
name: "default_name_8 (source application.group.name)" |
| 713 |
application: |
| 714 |
- |
| 715 |
id: "10" |
| 716 |
application_list: "<your_own_value> (source application.list.name)" |
| 717 |
auto_asic_offload: "enable" |
| 718 |
av_profile: "<your_own_value> (source antivirus.profile.name)" |
| 719 |
cifs_profile: "<your_own_value> (source cifs.profile.name)" |
| 720 |
comments: "<your_own_value>" |
| 721 |
custom_log_fields: |
| 722 |
- |
| 723 |
field_id: "<your_own_value> (source log.custom-field.id)" |
| 724 |
devices: |
| 725 |
- |
| 726 |
name: "default_name_19 (source user.device.alias user.device-group.name user.device-category.name)" |
| 727 |
diffserv_forward: "enable" |
| 728 |
diffserv_reverse: "enable" |
| 729 |
diffservcode_forward: "<your_own_value>" |
| 730 |
diffservcode_rev: "<your_own_value>" |
| 731 |
dlp_sensor: "<your_own_value> (source dlp.sensor.name)" |
| 732 |
dnsfilter_profile: "<your_own_value> (source dnsfilter.profile.name)" |
| 733 |
dscp_match: "enable" |
| 734 |
dscp_negate: "enable" |
| 735 |
dscp_value: "<your_own_value>" |
| 736 |
dsri: "enable" |
| 737 |
dstaddr: |
| 738 |
- |
| 739 |
name: "default_name_31 (source firewall.address6.name firewall.addrgrp6.name firewall.vip6.name firewall.vipgrp6.name system |
| 740 |
.external-resource.name)" |
| 741 |
dstaddr_negate: "enable" |
| 742 |
dstintf: |
| 743 |
- |
| 744 |
name: "default_name_34 (source system.interface.name system.zone.name)" |
| 745 |
emailfilter_profile: "<your_own_value> (source emailfilter.profile.name)" |
| 746 |
firewall_session_dirty: "check-all" |
| 747 |
fixedport: "enable" |
| 748 |
fsso_groups: |
| 749 |
- |
| 750 |
name: "default_name_39 (source user.adgrp.name)" |
| 751 |
global_label: "<your_own_value>" |
| 752 |
groups: |
| 753 |
- |
| 754 |
name: "default_name_42 (source user.group.name)" |
| 755 |
http_policy_redirect: "enable" |
| 756 |
icap_profile: "<your_own_value> (source icap.profile.name)" |
| 757 |
inbound: "enable" |
| 758 |
inspection_mode: "proxy" |
| 759 |
ippool: "enable" |
| 760 |
ips_sensor: "<your_own_value> (source ips.sensor.name)" |
| 761 |
label: "<your_own_value>" |
| 762 |
logtraffic: "all" |
| 763 |
logtraffic_start: "enable" |
| 764 |
mms_profile: "<your_own_value> (source firewall.mms-profile.name)" |
| 765 |
name: "default_name_53" |
| 766 |
nat: "enable" |
| 767 |
natinbound: "enable" |
| 768 |
natoutbound: "enable" |
| 769 |
np_acceleration: "enable" |
| 770 |
outbound: "enable" |
| 771 |
per_ip_shaper: "<your_own_value> (source firewall.shaper.per-ip-shaper.name)" |
| 772 |
policyid: "<you_own_value>" |
| 773 |
poolname: |
| 774 |
- |
| 775 |
name: "default_name_62 (source firewall.ippool6.name)" |
| 776 |
profile_group: "<your_own_value> (source firewall.profile-group.name)" |
| 777 |
profile_protocol_options: "<your_own_value> (source firewall.profile-protocol-options.name)" |
| 778 |
profile_type: "single" |
| 779 |
replacemsg_override_group: "<your_own_value> (source system.replacemsg-group.name)" |
| 780 |
rsso: "enable" |
| 781 |
schedule: "<your_own_value> (source firewall.schedule.onetime.name firewall.schedule.recurring.name firewall.schedule.group.name)" |
| 782 |
send_deny_packet: "enable" |
| 783 |
service: |
| 784 |
- |
| 785 |
name: "default_name_71 (source firewall.service.custom.name firewall.service.group.name)" |
| 786 |
service_negate: "enable" |
| 787 |
session_ttl: "<your_own_value>" |
| 788 |
spamfilter_profile: "<your_own_value> (source spamfilter.profile.name)" |
| 789 |
srcaddr: |
| 790 |
- |
| 791 |
name: "default_name_76 (source firewall.address6.name firewall.addrgrp6.name system.external-resource.name)" |
| 792 |
srcaddr_negate: "enable" |
| 793 |
srcintf: |
| 794 |
- |
| 795 |
name: "default_name_79 (source system.zone.name system.interface.name)" |
| 796 |
ssh_filter_profile: "<your_own_value> (source ssh-filter.profile.name)" |
| 797 |
ssh_policy_redirect: "enable" |
| 798 |
ssl_mirror: "enable" |
| 799 |
ssl_mirror_intf: |
| 800 |
- |
| 801 |
name: "default_name_84 (source system.zone.name system.interface.name)" |
| 802 |
ssl_ssh_profile: "<your_own_value> (source firewall.ssl-ssh-profile.name)" |
| 803 |
status: "enable" |
| 804 |
tcp_mss_receiver: "32767" |
| 805 |
tcp_mss_sender: "32767" |
| 806 |
tcp_session_without_syn: "all" |
| 807 |
timeout_send_rst: "enable" |
| 808 |
tos: "<your_own_value>" |
| 809 |
tos_mask: "<your_own_value>" |
| 810 |
tos_negate: "enable" |
| 811 |
traffic_shaper: "<your_own_value> (source firewall.shaper.traffic-shaper.name)" |
| 812 |
traffic_shaper_reverse: "<your_own_value> (source firewall.shaper.traffic-shaper.name)" |
| 813 |
url_category: |
| 814 |
- |
| 815 |
id: "97" |
| 816 |
users: |
| 817 |
- |
| 818 |
name: "default_name_99 (source user.local.name)" |
| 819 |
utm_status: "enable" |
| 820 |
uuid: "<your_own_value>" |
| 821 |
vlan_cos_fwd: "3" |
| 822 |
vlan_cos_rev: "3" |
| 823 |
vlan_filter: "<your_own_value>" |
| 824 |
voip_profile: "<your_own_value> (source voip.profile.name)" |
| 825 |
vpntunnel: "<your_own_value> (source vpn.ipsec.phase1.name vpn.ipsec.manualkey.name)" |
| 826 |
waf_profile: "<your_own_value> (source waf.profile.name)" |
| 827 |
webcache: "enable" |
| 828 |
webcache_https: "disable" |
| 829 |
webfilter_profile: "<your_own_value> (source webfilter.profile.name)" |
| 830 |
webproxy_forward_server: "<your_own_value> (source web-proxy.forward-server.name web-proxy.forward-server-group.name)" |
| 831 |
webproxy_profile: "<your_own_value> (source web-proxy.profile.name)" |
| 832 |
""" |
| 833 |
|
| 834 |
RETURN = """ |
| 835 |
build: |
| 836 |
description: Build number of the fortigate image |
| 837 |
returned: always |
| 838 |
type: str |
| 839 |
sample: '1547' |
| 840 |
http_method: |
| 841 |
description: Last method used to provision the content into FortiGate |
| 842 |
returned: always |
| 843 |
type: str |
| 844 |
sample: 'PUT' |
| 845 |
http_status: |
| 846 |
description: Last result given by FortiGate on last operation applied |
| 847 |
returned: always |
| 848 |
type: str |
| 849 |
sample: "200" |
| 850 |
mkey: |
| 851 |
description: Master key (id) used in the last call to FortiGate |
| 852 |
returned: success |
| 853 |
type: str |
| 854 |
sample: "id" |
| 855 |
name: |
| 856 |
description: Name of the table used to fulfill the request |
| 857 |
returned: always |
| 858 |
type: str |
| 859 |
sample: "urlfilter" |
| 860 |
path: |
| 861 |
description: Path of the table used to fulfill the request |
| 862 |
returned: always |
| 863 |
type: str |
| 864 |
sample: "webfilter" |
| 865 |
revision: |
| 866 |
description: Internal revision number |
| 867 |
returned: always |
| 868 |
type: str |
| 869 |
sample: "17.0.2.10658" |
| 870 |
serial: |
| 871 |
description: Serial number of the unit |
| 872 |
returned: always |
| 873 |
type: str |
| 874 |
sample: "FGVMEVYYQT3AB5352" |
| 875 |
status: |
| 876 |
description: Indication of the operation's result |
| 877 |
returned: always |
| 878 |
type: str |
| 879 |
sample: "success" |
| 880 |
vdom: |
| 881 |
description: Virtual domain used |
| 882 |
returned: always |
| 883 |
type: str |
| 884 |
sample: "root" |
| 885 |
version: |
| 886 |
description: Version of the FortiGate |
| 887 |
returned: always |
| 888 |
type: str |
| 889 |
sample: "v5.6.3" |
| 890 |
""" |
| 891 |
from ansible.module_utils.basic import AnsibleModule |
| 892 |
from ansible.module_utils.connection import Connection |
| 893 |
from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import ( |
| 894 |
FortiOSHandler, |
| 895 |
) |
| 896 |
from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import ( |
| 897 |
check_legacy_fortiosapi, |
| 898 |
) |
| 899 |
from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import ( |
| 900 |
schema_to_module_spec, |
| 901 |
) |
| 902 |
from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.fortios import ( |
| 903 |
check_schema_versioning, |
| 904 |
) |
| 905 |
from ansible_collections.fortinet.fortios.plugins.module_utils.fortimanager.common import ( |
| 906 |
FAIL_SOCKET_MSG, |
| 907 |
) |
| 908 |
from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.data_post_processor import ( |
| 909 |
remove_invalid_fields, |
| 910 |
) |
| 911 |
from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import ( |
| 912 |
is_same_comparison, |
| 913 |
) |
| 914 |
from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import ( |
| 915 |
serialize, |
| 916 |
) |
| 917 |
from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import ( |
| 918 |
find_current_values, |
| 919 |
) |
| 920 |
from ansible_collections.fortinet.fortios.plugins.module_utils.fortios.comparison import ( |
| 921 |
unify_data_format, |
| 922 |
) |
| 923 |
|
| 924 |
|
| 925 |
def filter_firewall_policy6_data(json): |
| 926 |
option_list = [ |
| 927 |
"action", |
| 928 |
"anti_replay", |
| 929 |
"app_category", |
| 930 |
"app_group", |
| 931 |
"application", |
| 932 |
"application_list", |
| 933 |
"auto_asic_offload", |
| 934 |
"av_profile", |
| 935 |
"cifs_profile", |
| 936 |
"comments", |
| 937 |
"custom_log_fields", |
| 938 |
"devices", |
| 939 |
"diffserv_forward", |
| 940 |
"diffserv_reverse", |
| 941 |
"diffservcode_forward", |
| 942 |
"diffservcode_rev", |
| 943 |
"dlp_sensor", |
| 944 |
"dnsfilter_profile", |
| 945 |
"dscp_match", |
| 946 |
"dscp_negate", |
| 947 |
"dscp_value", |
| 948 |
"dsri", |
| 949 |
"dstaddr", |
| 950 |
"dstaddr_negate", |
| 951 |
"dstintf", |
| 952 |
"emailfilter_profile", |
| 953 |
"firewall_session_dirty", |
| 954 |
"fixedport", |
| 955 |
"fsso_groups", |
| 956 |
"global_label", |
| 957 |
"groups", |
| 958 |
"http_policy_redirect", |
| 959 |
"icap_profile", |
| 960 |
"inbound", |
| 961 |
"inspection_mode", |
| 962 |
"ippool", |
| 963 |
"ips_sensor", |
| 964 |
"label", |
| 965 |
"logtraffic", |
| 966 |
"logtraffic_start", |
| 967 |
"mms_profile", |
| 968 |
"name", |
| 969 |
"nat", |
| 970 |
"natinbound", |
| 971 |
"natoutbound", |
| 972 |
"np_acceleration", |
| 973 |
"outbound", |
| 974 |
"per_ip_shaper", |
| 975 |
"policyid", |
| 976 |
"poolname", |
| 977 |
"profile_group", |
| 978 |
"profile_protocol_options", |
| 979 |
"profile_type", |
| 980 |
"replacemsg_override_group", |
| 981 |
"rsso", |
| 982 |
"schedule", |
| 983 |
"send_deny_packet", |
| 984 |
"service", |
| 985 |
"service_negate", |
| 986 |
"session_ttl", |
| 987 |
"spamfilter_profile", |
| 988 |
"srcaddr", |
| 989 |
"srcaddr_negate", |
| 990 |
"srcintf", |
| 991 |
"ssh_filter_profile", |
| 992 |
"ssh_policy_redirect", |
| 993 |
"ssl_mirror", |
| 994 |
"ssl_mirror_intf", |
| 995 |
"ssl_ssh_profile", |
| 996 |
"status", |
| 997 |
"tcp_mss_receiver", |
| 998 |
"tcp_mss_sender", |
| 999 |
"tcp_session_without_syn", |
| 1000 |
"timeout_send_rst", |
| 1001 |
"tos", |
| 1002 |
"tos_mask", |
| 1003 |
"tos_negate", |
| 1004 |
"traffic_shaper", |
| 1005 |
"traffic_shaper_reverse", |
| 1006 |
"url_category", |
| 1007 |
"users", |
| 1008 |
"utm_status", |
| 1009 |
"uuid", |
| 1010 |
"vlan_cos_fwd", |
| 1011 |
"vlan_cos_rev", |
| 1012 |
"vlan_filter", |
| 1013 |
"voip_profile", |
| 1014 |
"vpntunnel", |
| 1015 |
"waf_profile", |
| 1016 |
"webcache", |
| 1017 |
"webcache_https", |
| 1018 |
"webfilter_profile", |
| 1019 |
"webproxy_forward_server", |
| 1020 |
"webproxy_profile", |
| 1021 |
] |
| 1022 |
|
| 1023 |
json = remove_invalid_fields(json) |
| 1024 |
dictionary = {} |
| 1025 |
|
| 1026 |
for attribute in option_list: |
| 1027 |
if attribute in json and json[attribute] is not None: |
| 1028 |
dictionary[attribute] = json[attribute] |
| 1029 |
|
| 1030 |
return dictionary |
| 1031 |
|
| 1032 |
|
| 1033 |
def underscore_to_hyphen(data): |
| 1034 |
new_data = None |
| 1035 |
if isinstance(data, list): |
| 1036 |
new_data = [] |
| 1037 |
for i, elem in enumerate(data): |
| 1038 |
new_data.append(underscore_to_hyphen(elem)) |
| 1039 |
elif isinstance(data, dict): |
| 1040 |
new_data = {} |
| 1041 |
for k, v in data.items(): |
| 1042 |
new_data[k.replace("_", "-")] = underscore_to_hyphen(v) |
| 1043 |
else: |
| 1044 |
return data |
| 1045 |
return new_data |
| 1046 |
|
| 1047 |
|
| 1048 |
def firewall_policy6(data, fos, check_mode=False): |
| 1049 |
|
| 1050 |
state = None |
| 1051 |
vdom = data["vdom"] |
| 1052 |
parameters = None |
| 1053 |
state = data.get("state", None) |
| 1054 |
firewall_policy6_data = data["firewall_policy6"] |
| 1055 |
|
| 1056 |
filtered_data = filter_firewall_policy6_data(firewall_policy6_data) |
| 1057 |
converted_data = underscore_to_hyphen(filtered_data) |
| 1058 |
|
| 1059 |
|
| 1060 |
if check_mode: |
| 1061 |
diff = { |
| 1062 |
"before": "", |
| 1063 |
"after": filtered_data, |
| 1064 |
} |
| 1065 |
mkeyname = fos.get_mkeyname(None, None) |
| 1066 |
mkey = fos.get_mkey("firewall", "policy6", filtered_data, vdom=vdom) |
| 1067 |
current_data = fos.get( |
| 1068 |
"firewall", "policy6", vdom=vdom, mkey=mkey, parameters=parameters |
| 1069 |
) |
| 1070 |
is_existed = ( |
| 1071 |
current_data |
| 1072 |
and current_data.get("http_status") == 200 |
| 1073 |
and ( |
| 1074 |
mkeyname |
| 1075 |
and isinstance(current_data.get("results"), list) |
| 1076 |
and len(current_data["results"]) > 0 |
| 1077 |
or not mkeyname |
| 1078 |
and current_data["results"] |
| 1079 |
) |
| 1080 |
) |
| 1081 |
|
| 1082 |
|
| 1083 |
if state == "present" or state is True or state is None: |
| 1084 |
|
| 1085 |
if mkeyname is not None and mkey is None: |
| 1086 |
return False, True, filtered_data, diff |
| 1087 |
|
| 1088 |
|
| 1089 |
|
| 1090 |
copied_filtered_data = filtered_data.copy() |
| 1091 |
copied_filtered_data.pop(mkeyname, None) |
| 1092 |
unified_filtered_data = unify_data_format(copied_filtered_data) |
| 1093 |
|
| 1094 |
current_data_results = current_data.get("results", {}) |
| 1095 |
current_config = ( |
| 1096 |
current_data_results[0] |
| 1097 |
if mkeyname |
| 1098 |
and isinstance(current_data_results, list) |
| 1099 |
and len(current_data_results) > 0 |
| 1100 |
else current_data_results |
| 1101 |
) |
| 1102 |
if is_existed: |
| 1103 |
unified_current_values = find_current_values( |
| 1104 |
unified_filtered_data, |
| 1105 |
unify_data_format(current_config), |
| 1106 |
) |
| 1107 |
|
| 1108 |
is_same = is_same_comparison( |
| 1109 |
serialize(unified_current_values), serialize(unified_filtered_data) |
| 1110 |
) |
| 1111 |
|
| 1112 |
return ( |
| 1113 |
False, |
| 1114 |
not is_same, |
| 1115 |
filtered_data, |
| 1116 |
{"before": unified_current_values, "after": unified_filtered_data}, |
| 1117 |
) |
| 1118 |
|
| 1119 |
|
| 1120 |
return False, True, filtered_data, diff |
| 1121 |
|
| 1122 |
if state == "absent": |
| 1123 |
if mkey is None: |
| 1124 |
return ( |
| 1125 |
False, |
| 1126 |
False, |
| 1127 |
filtered_data, |
| 1128 |
{"before": current_data["results"][0], "after": ""}, |
| 1129 |
) |
| 1130 |
|
| 1131 |
if is_existed: |
| 1132 |
return ( |
| 1133 |
False, |
| 1134 |
True, |
| 1135 |
filtered_data, |
| 1136 |
{"before": current_data["results"][0], "after": ""}, |
| 1137 |
) |
| 1138 |
return False, False, filtered_data, {} |
| 1139 |
|
| 1140 |
return True, False, {"reason: ": "Must provide state parameter"}, {} |
| 1141 |
|
| 1142 |
|
| 1143 |
data_copy = data.copy() |
| 1144 |
data_copy["firewall_policy6"] = filtered_data |
| 1145 |
fos.do_member_operation( |
| 1146 |
"firewall", |
| 1147 |
"policy6", |
| 1148 |
data_copy, |
| 1149 |
) |
| 1150 |
|
| 1151 |
if state == "present" or state is True: |
| 1152 |
return fos.set( |
| 1153 |
"firewall", "policy6", data=converted_data, vdom=vdom, parameters=parameters |
| 1154 |
) |
| 1155 |
|
| 1156 |
elif state == "absent": |
| 1157 |
return fos.delete( |
| 1158 |
"firewall", |
| 1159 |
"policy6", |
| 1160 |
mkey=converted_data["policyid"], |
| 1161 |
vdom=vdom, |
| 1162 |
parameters=parameters, |
| 1163 |
) |
| 1164 |
else: |
| 1165 |
fos._module.fail_json(msg="state must be present or absent!") |
| 1166 |
|
| 1167 |
|
| 1168 |
def is_successful_status(resp): |
| 1169 |
return ( |
| 1170 |
"status" in resp |
| 1171 |
and resp["status"] == "success" |
| 1172 |
or "http_status" in resp |
| 1173 |
and resp["http_status"] == 200 |
| 1174 |
or "http_method" in resp |
| 1175 |
and resp["http_method"] == "DELETE" |
| 1176 |
and resp["http_status"] == 404 |
| 1177 |
) |
| 1178 |
|
| 1179 |
|
| 1180 |
def fortios_firewall(data, fos, check_mode): |
| 1181 |
|
| 1182 |
if data["firewall_policy6"]: |
| 1183 |
resp = firewall_policy6(data, fos, check_mode) |
| 1184 |
else: |
| 1185 |
fos._module.fail_json(msg="missing task body: %s" % ("firewall_policy6")) |
| 1186 |
if isinstance(resp, tuple) and len(resp) == 4: |
| 1187 |
return resp |
| 1188 |
return ( |
| 1189 |
not is_successful_status(resp), |
| 1190 |
is_successful_status(resp) |
| 1191 |
and (resp["revision_changed"] if "revision_changed" in resp else True), |
| 1192 |
resp, |
| 1193 |
{}, |
| 1194 |
) |
| 1195 |
|
| 1196 |
|
| 1197 |
versioned_schema = { |
| 1198 |
"type": "list", |
| 1199 |
"elements": "dict", |
| 1200 |
"children": { |
| 1201 |
"policyid": { |
| 1202 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1203 |
"type": "integer", |
| 1204 |
"required": True, |
| 1205 |
}, |
| 1206 |
"name": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1207 |
"uuid": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1208 |
"srcintf": { |
| 1209 |
"type": "list", |
| 1210 |
"elements": "dict", |
| 1211 |
"children": { |
| 1212 |
"name": { |
| 1213 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1214 |
"type": "string", |
| 1215 |
"required": True, |
| 1216 |
} |
| 1217 |
}, |
| 1218 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1219 |
}, |
| 1220 |
"dstintf": { |
| 1221 |
"type": "list", |
| 1222 |
"elements": "dict", |
| 1223 |
"children": { |
| 1224 |
"name": { |
| 1225 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1226 |
"type": "string", |
| 1227 |
"required": True, |
| 1228 |
} |
| 1229 |
}, |
| 1230 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1231 |
}, |
| 1232 |
"srcaddr": { |
| 1233 |
"type": "list", |
| 1234 |
"elements": "dict", |
| 1235 |
"children": { |
| 1236 |
"name": { |
| 1237 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1238 |
"type": "string", |
| 1239 |
"required": True, |
| 1240 |
} |
| 1241 |
}, |
| 1242 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1243 |
}, |
| 1244 |
"dstaddr": { |
| 1245 |
"type": "list", |
| 1246 |
"elements": "dict", |
| 1247 |
"children": { |
| 1248 |
"name": { |
| 1249 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1250 |
"type": "string", |
| 1251 |
"required": True, |
| 1252 |
} |
| 1253 |
}, |
| 1254 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1255 |
}, |
| 1256 |
"action": { |
| 1257 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1258 |
"type": "string", |
| 1259 |
"options": [{"value": "accept"}, {"value": "deny"}, {"value": "ipsec"}], |
| 1260 |
}, |
| 1261 |
"firewall_session_dirty": { |
| 1262 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1263 |
"type": "string", |
| 1264 |
"options": [{"value": "check-all"}, {"value": "check-new"}], |
| 1265 |
}, |
| 1266 |
"status": { |
| 1267 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1268 |
"type": "string", |
| 1269 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1270 |
}, |
| 1271 |
"vlan_cos_fwd": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "integer"}, |
| 1272 |
"vlan_cos_rev": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "integer"}, |
| 1273 |
"schedule": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1274 |
"service": { |
| 1275 |
"type": "list", |
| 1276 |
"elements": "dict", |
| 1277 |
"children": { |
| 1278 |
"name": { |
| 1279 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1280 |
"type": "string", |
| 1281 |
"required": True, |
| 1282 |
} |
| 1283 |
}, |
| 1284 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1285 |
}, |
| 1286 |
"tos": {"v_range": [["v6.2.0", "v6.2.7"]], "type": "string"}, |
| 1287 |
"tos_mask": {"v_range": [["v6.2.0", "v6.2.7"]], "type": "string"}, |
| 1288 |
"tos_negate": { |
| 1289 |
"v_range": [["v6.2.0", "v6.2.7"]], |
| 1290 |
"type": "string", |
| 1291 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1292 |
}, |
| 1293 |
"tcp_session_without_syn": { |
| 1294 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1295 |
"type": "string", |
| 1296 |
"options": [{"value": "all"}, {"value": "data-only"}, {"value": "disable"}], |
| 1297 |
}, |
| 1298 |
"anti_replay": { |
| 1299 |
"v_range": [["v6.2.0", "v6.2.7"]], |
| 1300 |
"type": "string", |
| 1301 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1302 |
}, |
| 1303 |
"utm_status": { |
| 1304 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1305 |
"type": "string", |
| 1306 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1307 |
}, |
| 1308 |
"inspection_mode": { |
| 1309 |
"v_range": [["v6.2.0", "v6.2.7"]], |
| 1310 |
"type": "string", |
| 1311 |
"options": [{"value": "proxy"}, {"value": "flow"}], |
| 1312 |
}, |
| 1313 |
"webcache": { |
| 1314 |
"v_range": [["v6.2.0", "v6.2.7"]], |
| 1315 |
"type": "string", |
| 1316 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1317 |
}, |
| 1318 |
"webcache_https": { |
| 1319 |
"v_range": [["v6.2.0", "v6.2.7"]], |
| 1320 |
"type": "string", |
| 1321 |
"options": [{"value": "disable"}, {"value": "enable"}], |
| 1322 |
}, |
| 1323 |
"http_policy_redirect": { |
| 1324 |
"v_range": [["v6.2.0", "v6.2.7"]], |
| 1325 |
"type": "string", |
| 1326 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1327 |
}, |
| 1328 |
"ssh_policy_redirect": { |
| 1329 |
"v_range": [["v6.2.0", "v6.2.7"]], |
| 1330 |
"type": "string", |
| 1331 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1332 |
}, |
| 1333 |
"webproxy_profile": {"v_range": [["v6.2.0", "v6.2.7"]], "type": "string"}, |
| 1334 |
"profile_type": { |
| 1335 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1336 |
"type": "string", |
| 1337 |
"options": [{"value": "single"}, {"value": "group"}], |
| 1338 |
}, |
| 1339 |
"profile_group": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1340 |
"profile_protocol_options": { |
| 1341 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1342 |
"type": "string", |
| 1343 |
}, |
| 1344 |
"ssl_ssh_profile": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1345 |
"av_profile": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1346 |
"webfilter_profile": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1347 |
"dnsfilter_profile": {"v_range": [["v6.2.0", "v6.2.7"]], "type": "string"}, |
| 1348 |
"emailfilter_profile": {"v_range": [["v6.2.0", "v6.2.7"]], "type": "string"}, |
| 1349 |
"dlp_sensor": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1350 |
"ips_sensor": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1351 |
"application_list": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1352 |
"voip_profile": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1353 |
"mms_profile": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1354 |
"icap_profile": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1355 |
"cifs_profile": {"v_range": [["v6.2.0", "v6.2.7"]], "type": "string"}, |
| 1356 |
"waf_profile": {"v_range": [["v6.2.0", "v6.2.7"]], "type": "string"}, |
| 1357 |
"ssh_filter_profile": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1358 |
"logtraffic": { |
| 1359 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1360 |
"type": "string", |
| 1361 |
"options": [{"value": "all"}, {"value": "utm"}, {"value": "disable"}], |
| 1362 |
}, |
| 1363 |
"logtraffic_start": { |
| 1364 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1365 |
"type": "string", |
| 1366 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1367 |
}, |
| 1368 |
"auto_asic_offload": { |
| 1369 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1370 |
"type": "string", |
| 1371 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1372 |
}, |
| 1373 |
"np_acceleration": { |
| 1374 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1375 |
"type": "string", |
| 1376 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1377 |
}, |
| 1378 |
"webproxy_forward_server": { |
| 1379 |
"v_range": [["v6.2.0", "v6.2.7"]], |
| 1380 |
"type": "string", |
| 1381 |
}, |
| 1382 |
"traffic_shaper": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1383 |
"traffic_shaper_reverse": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1384 |
"per_ip_shaper": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1385 |
"application": { |
| 1386 |
"type": "list", |
| 1387 |
"elements": "dict", |
| 1388 |
"children": { |
| 1389 |
"id": { |
| 1390 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1391 |
"type": "integer", |
| 1392 |
"required": True, |
| 1393 |
} |
| 1394 |
}, |
| 1395 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1396 |
}, |
| 1397 |
"app_category": { |
| 1398 |
"type": "list", |
| 1399 |
"elements": "dict", |
| 1400 |
"children": { |
| 1401 |
"id": { |
| 1402 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1403 |
"type": "integer", |
| 1404 |
"required": True, |
| 1405 |
} |
| 1406 |
}, |
| 1407 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1408 |
}, |
| 1409 |
"url_category": { |
| 1410 |
"type": "list", |
| 1411 |
"elements": "dict", |
| 1412 |
"children": { |
| 1413 |
"id": { |
| 1414 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1415 |
"type": "integer", |
| 1416 |
"required": True, |
| 1417 |
} |
| 1418 |
}, |
| 1419 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1420 |
}, |
| 1421 |
"app_group": { |
| 1422 |
"type": "list", |
| 1423 |
"elements": "dict", |
| 1424 |
"children": { |
| 1425 |
"name": { |
| 1426 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1427 |
"type": "string", |
| 1428 |
"required": True, |
| 1429 |
} |
| 1430 |
}, |
| 1431 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1432 |
}, |
| 1433 |
"nat": { |
| 1434 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1435 |
"type": "string", |
| 1436 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1437 |
}, |
| 1438 |
"fixedport": { |
| 1439 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1440 |
"type": "string", |
| 1441 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1442 |
}, |
| 1443 |
"ippool": { |
| 1444 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1445 |
"type": "string", |
| 1446 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1447 |
}, |
| 1448 |
"poolname": { |
| 1449 |
"type": "list", |
| 1450 |
"elements": "dict", |
| 1451 |
"children": { |
| 1452 |
"name": { |
| 1453 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1454 |
"type": "string", |
| 1455 |
"required": True, |
| 1456 |
} |
| 1457 |
}, |
| 1458 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1459 |
}, |
| 1460 |
"session_ttl": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1461 |
"inbound": { |
| 1462 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1463 |
"type": "string", |
| 1464 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1465 |
}, |
| 1466 |
"outbound": { |
| 1467 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1468 |
"type": "string", |
| 1469 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1470 |
}, |
| 1471 |
"natinbound": { |
| 1472 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1473 |
"type": "string", |
| 1474 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1475 |
}, |
| 1476 |
"natoutbound": { |
| 1477 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1478 |
"type": "string", |
| 1479 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1480 |
}, |
| 1481 |
"send_deny_packet": { |
| 1482 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1483 |
"type": "string", |
| 1484 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1485 |
}, |
| 1486 |
"vpntunnel": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1487 |
"diffserv_forward": { |
| 1488 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1489 |
"type": "string", |
| 1490 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1491 |
}, |
| 1492 |
"diffserv_reverse": { |
| 1493 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1494 |
"type": "string", |
| 1495 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1496 |
}, |
| 1497 |
"diffservcode_forward": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1498 |
"diffservcode_rev": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1499 |
"tcp_mss_sender": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "integer"}, |
| 1500 |
"tcp_mss_receiver": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "integer"}, |
| 1501 |
"comments": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1502 |
"rsso": { |
| 1503 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1504 |
"type": "string", |
| 1505 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1506 |
}, |
| 1507 |
"custom_log_fields": { |
| 1508 |
"type": "list", |
| 1509 |
"elements": "dict", |
| 1510 |
"children": { |
| 1511 |
"field_id": { |
| 1512 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1513 |
"type": "string", |
| 1514 |
"required": True, |
| 1515 |
} |
| 1516 |
}, |
| 1517 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1518 |
}, |
| 1519 |
"replacemsg_override_group": { |
| 1520 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1521 |
"type": "string", |
| 1522 |
}, |
| 1523 |
"srcaddr_negate": { |
| 1524 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1525 |
"type": "string", |
| 1526 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1527 |
}, |
| 1528 |
"dstaddr_negate": { |
| 1529 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1530 |
"type": "string", |
| 1531 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1532 |
}, |
| 1533 |
"service_negate": { |
| 1534 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1535 |
"type": "string", |
| 1536 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1537 |
}, |
| 1538 |
"groups": { |
| 1539 |
"type": "list", |
| 1540 |
"elements": "dict", |
| 1541 |
"children": { |
| 1542 |
"name": { |
| 1543 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1544 |
"type": "string", |
| 1545 |
"required": True, |
| 1546 |
} |
| 1547 |
}, |
| 1548 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1549 |
}, |
| 1550 |
"users": { |
| 1551 |
"type": "list", |
| 1552 |
"elements": "dict", |
| 1553 |
"children": { |
| 1554 |
"name": { |
| 1555 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1556 |
"type": "string", |
| 1557 |
"required": True, |
| 1558 |
} |
| 1559 |
}, |
| 1560 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1561 |
}, |
| 1562 |
"timeout_send_rst": { |
| 1563 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1564 |
"type": "string", |
| 1565 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1566 |
}, |
| 1567 |
"ssl_mirror": { |
| 1568 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1569 |
"type": "string", |
| 1570 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1571 |
}, |
| 1572 |
"ssl_mirror_intf": { |
| 1573 |
"type": "list", |
| 1574 |
"elements": "dict", |
| 1575 |
"children": { |
| 1576 |
"name": { |
| 1577 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1578 |
"type": "string", |
| 1579 |
"required": True, |
| 1580 |
} |
| 1581 |
}, |
| 1582 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1583 |
}, |
| 1584 |
"dsri": { |
| 1585 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1586 |
"type": "string", |
| 1587 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1588 |
}, |
| 1589 |
"vlan_filter": {"v_range": [["v6.0.0", "v6.2.7"]], "type": "string"}, |
| 1590 |
"fsso_groups": { |
| 1591 |
"type": "list", |
| 1592 |
"elements": "dict", |
| 1593 |
"children": { |
| 1594 |
"name": { |
| 1595 |
"v_range": [["v6.2.0", "v6.2.7"]], |
| 1596 |
"type": "string", |
| 1597 |
"required": True, |
| 1598 |
} |
| 1599 |
}, |
| 1600 |
"v_range": [["v6.2.0", "v6.2.7"]], |
| 1601 |
}, |
| 1602 |
"label": { |
| 1603 |
"v_range": [["v6.0.0", "v6.0.11"], ["v6.2.3", "v6.2.3"]], |
| 1604 |
"type": "string", |
| 1605 |
}, |
| 1606 |
"global_label": { |
| 1607 |
"v_range": [["v6.0.0", "v6.0.11"], ["v6.2.3", "v6.2.3"]], |
| 1608 |
"type": "string", |
| 1609 |
}, |
| 1610 |
"devices": { |
| 1611 |
"type": "list", |
| 1612 |
"elements": "dict", |
| 1613 |
"children": { |
| 1614 |
"name": { |
| 1615 |
"v_range": [["v6.0.0", "v6.0.11"], ["v6.2.3", "v6.2.3"]], |
| 1616 |
"type": "string", |
| 1617 |
"required": True, |
| 1618 |
} |
| 1619 |
}, |
| 1620 |
"v_range": [["v6.0.0", "v6.0.11"], ["v6.2.3", "v6.2.3"]], |
| 1621 |
}, |
| 1622 |
"dscp_match": { |
| 1623 |
"v_range": [["v6.0.0", "v6.0.11"]], |
| 1624 |
"type": "string", |
| 1625 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1626 |
}, |
| 1627 |
"dscp_negate": { |
| 1628 |
"v_range": [["v6.0.0", "v6.0.11"]], |
| 1629 |
"type": "string", |
| 1630 |
"options": [{"value": "enable"}, {"value": "disable"}], |
| 1631 |
}, |
| 1632 |
"dscp_value": {"v_range": [["v6.0.0", "v6.0.11"]], "type": "string"}, |
| 1633 |
"spamfilter_profile": {"v_range": [["v6.0.0", "v6.0.11"]], "type": "string"}, |
| 1634 |
}, |
| 1635 |
"v_range": [["v6.0.0", "v6.2.7"]], |
| 1636 |
} |
| 1637 |
|
| 1638 |
|
| 1639 |
def main(): |
| 1640 |
module_spec = schema_to_module_spec(versioned_schema) |
| 1641 |
mkeyname = "policyid" |
| 1642 |
fields = { |
| 1643 |
"access_token": {"required": False, "type": "str", "no_log": True}, |
| 1644 |
"enable_log": {"required": False, "type": "bool", "default": False}, |
| 1645 |
"vdom": {"required": False, "type": "str", "default": "root"}, |
| 1646 |
"member_path": {"required": False, "type": "str"}, |
| 1647 |
"member_state": { |
| 1648 |
"type": "str", |
| 1649 |
"required": False, |
| 1650 |
"choices": ["present", "absent"], |
| 1651 |
}, |
| 1652 |
"state": {"required": True, "type": "str", "choices": ["present", "absent"]}, |
| 1653 |
"firewall_policy6": { |
| 1654 |
"required": False, |
| 1655 |
"type": "dict", |
| 1656 |
"default": None, |
| 1657 |
"options": {}, |
| 1658 |
}, |
| 1659 |
} |
| 1660 |
for attribute_name in module_spec["options"]: |
| 1661 |
fields["firewall_policy6"]["options"][attribute_name] = module_spec["options"][ |
| 1662 |
attribute_name |
| 1663 |
] |
| 1664 |
if mkeyname and mkeyname == attribute_name: |
| 1665 |
fields["firewall_policy6"]["options"][attribute_name]["required"] = True |
| 1666 |
|
| 1667 |
module = AnsibleModule(argument_spec=fields, supports_check_mode=True) |
| 1668 |
check_legacy_fortiosapi(module) |
| 1669 |
|
| 1670 |
is_error = False |
| 1671 |
has_changed = False |
| 1672 |
result = None |
| 1673 |
diff = None |
| 1674 |
|
| 1675 |
versions_check_result = None |
| 1676 |
if module._socket_path: |
| 1677 |
connection = Connection(module._socket_path) |
| 1678 |
if "access_token" in module.params: |
| 1679 |
connection.set_custom_option("access_token", module.params["access_token"]) |
| 1680 |
|
| 1681 |
if "enable_log" in module.params: |
| 1682 |
connection.set_custom_option("enable_log", module.params["enable_log"]) |
| 1683 |
else: |
| 1684 |
connection.set_custom_option("enable_log", False) |
| 1685 |
fos = FortiOSHandler(connection, module, mkeyname, admin_passwd_header=False) |
| 1686 |
versions_check_result = check_schema_versioning( |
| 1687 |
fos, versioned_schema, "firewall_policy6" |
| 1688 |
) |
| 1689 |
|
| 1690 |
is_error, has_changed, result, diff = fortios_firewall( |
| 1691 |
module.params, fos, module.check_mode |
| 1692 |
) |
| 1693 |
|
| 1694 |
else: |
| 1695 |
module.fail_json(**FAIL_SOCKET_MSG) |
| 1696 |
|
| 1697 |
if versions_check_result and versions_check_result["matched"] is False: |
| 1698 |
module.warn( |
| 1699 |
"Ansible has detected version mismatch between FortOS system and your playbook, see more details by specifying option -vvv" |
| 1700 |
) |
| 1701 |
|
| 1702 |
if not is_error: |
| 1703 |
if versions_check_result and versions_check_result["matched"] is False: |
| 1704 |
module.exit_json( |
| 1705 |
changed=has_changed, |
| 1706 |
version_check_warning=versions_check_result, |
| 1707 |
meta=result, |
| 1708 |
diff=diff, |
| 1709 |
) |
| 1710 |
else: |
| 1711 |
module.exit_json(changed=has_changed, meta=result, diff=diff) |
| 1712 |
else: |
| 1713 |
if versions_check_result and versions_check_result["matched"] is False: |
| 1714 |
module.fail_json( |
| 1715 |
msg="Error in repo", |
| 1716 |
version_check_warning=versions_check_result, |
| 1717 |
meta=result, |
| 1718 |
) |
| 1719 |
else: |
| 1720 |
module.fail_json(msg="Error in repo", meta=result) |
| 1721 |
|
| 1722 |
|
| 1723 |
if __name__ == "__main__": |
| 1724 |
main() |