| 1 |
|
| 2 |
from __future__ import absolute_import, division, print_function |
| 3 |
|
| 4 |
|
| 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_address |
| 15 |
short_description: Configure IPv4 addresses. |
| 16 |
version_added: "1.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 |
firewall_address: |
| 29 |
description: The top level parameters set. |
| 30 |
required: false |
| 31 |
type: dict |
| 32 |
suboptions: |
| 33 |
allow_routing: |
| 34 |
aliases: ['allow-routing'] |
| 35 |
type: str |
| 36 |
description: Enable/disable use of this address in the static route configuration. |
| 37 |
choices: ['disable', 'enable'] |
| 38 |
associated_interface: |
| 39 |
aliases: ['associated-interface'] |
| 40 |
type: str |
| 41 |
description: Network interface associated with address. |
| 42 |
cache_ttl: |
| 43 |
aliases: ['cache-ttl'] |
| 44 |
type: int |
| 45 |
description: Defines the minimal TTL of individual IP addresses in FQDN cache measured in seconds. |
| 46 |
color: |
| 47 |
type: int |
| 48 |
description: Color of icon on the GUI. |
| 49 |
comment: |
| 50 |
type: raw |
| 51 |
description: (dict or str) Comment. |
| 52 |
country: |
| 53 |
type: str |
| 54 |
description: IP addresses associated to a specific country. |
| 55 |
dynamic_mapping: |
| 56 |
type: list |
| 57 |
elements: dict |
| 58 |
description: Dynamic mapping. |
| 59 |
suboptions: |
| 60 |
_scope: |
| 61 |
type: list |
| 62 |
elements: dict |
| 63 |
description: Scope. |
| 64 |
suboptions: |
| 65 |
name: |
| 66 |
type: str |
| 67 |
description: Name. |
| 68 |
vdom: |
| 69 |
type: str |
| 70 |
description: Vdom. |
| 71 |
allow_routing: |
| 72 |
aliases: ['allow-routing'] |
| 73 |
type: str |
| 74 |
description: Allow routing. |
| 75 |
choices: ['disable', 'enable'] |
| 76 |
associated_interface: |
| 77 |
aliases: ['associated-interface'] |
| 78 |
type: str |
| 79 |
description: Associated interface. |
| 80 |
cache_ttl: |
| 81 |
aliases: ['cache-ttl'] |
| 82 |
type: int |
| 83 |
description: Cache ttl. |
| 84 |
color: |
| 85 |
type: int |
| 86 |
description: Color. |
| 87 |
comment: |
| 88 |
type: raw |
| 89 |
description: (dict or str) Comment. |
| 90 |
country: |
| 91 |
type: str |
| 92 |
description: Country. |
| 93 |
end_ip: |
| 94 |
aliases: ['end-ip'] |
| 95 |
type: str |
| 96 |
description: End ip. |
| 97 |
end_mac: |
| 98 |
aliases: ['end-mac'] |
| 99 |
type: str |
| 100 |
description: End mac. |
| 101 |
epg_name: |
| 102 |
aliases: ['epg-name'] |
| 103 |
type: str |
| 104 |
description: Epg name. |
| 105 |
filter: |
| 106 |
type: str |
| 107 |
description: Filter. |
| 108 |
fqdn: |
| 109 |
type: str |
| 110 |
description: Fqdn. |
| 111 |
interface: |
| 112 |
type: str |
| 113 |
description: Interface. |
| 114 |
obj_id: |
| 115 |
aliases: ['obj-id'] |
| 116 |
type: str |
| 117 |
description: Obj id. |
| 118 |
organization: |
| 119 |
type: str |
| 120 |
description: Organization. |
| 121 |
policy_group: |
| 122 |
aliases: ['policy-group'] |
| 123 |
type: str |
| 124 |
description: Policy group. |
| 125 |
sdn: |
| 126 |
type: str |
| 127 |
description: Sdn. |
| 128 |
choices: ['aci', 'aws', 'nsx', 'nuage', 'azure', 'gcp', 'oci', 'openstack'] |
| 129 |
sdn_addr_type: |
| 130 |
aliases: ['sdn-addr-type'] |
| 131 |
type: str |
| 132 |
description: Sdn addr type. |
| 133 |
choices: ['private', 'public', 'all'] |
| 134 |
sdn_tag: |
| 135 |
aliases: ['sdn-tag'] |
| 136 |
type: str |
| 137 |
description: Sdn tag. |
| 138 |
start_ip: |
| 139 |
aliases: ['start-ip'] |
| 140 |
type: str |
| 141 |
description: Start ip. |
| 142 |
start_mac: |
| 143 |
aliases: ['start-mac'] |
| 144 |
type: str |
| 145 |
description: Start mac. |
| 146 |
subnet: |
| 147 |
type: str |
| 148 |
description: Subnet. |
| 149 |
subnet_name: |
| 150 |
aliases: ['subnet-name'] |
| 151 |
type: str |
| 152 |
description: Subnet name. |
| 153 |
tags: |
| 154 |
type: raw |
| 155 |
description: (list or str) Tags. |
| 156 |
tenant: |
| 157 |
type: str |
| 158 |
description: Tenant. |
| 159 |
type: |
| 160 |
type: str |
| 161 |
description: Type. |
| 162 |
choices: ['ipmask', 'iprange', 'fqdn', 'wildcard', 'geography', 'url', |
| 163 |
'wildcard-fqdn', 'nsx', 'aws', 'dynamic', 'interface-subnet', |
| 164 |
'mac', 'fqdn-group', 'route-tag'] |
| 165 |
url: |
| 166 |
type: str |
| 167 |
description: Url. |
| 168 |
uuid: |
| 169 |
type: str |
| 170 |
description: Uuid. |
| 171 |
visibility: |
| 172 |
type: str |
| 173 |
description: Visibility. |
| 174 |
choices: ['disable', 'enable'] |
| 175 |
wildcard: |
| 176 |
type: str |
| 177 |
description: Wildcard. |
| 178 |
wildcard_fqdn: |
| 179 |
aliases: ['wildcard-fqdn'] |
| 180 |
type: str |
| 181 |
description: Wildcard fqdn. |
| 182 |
_image_base64: |
| 183 |
aliases: ['_image-base64'] |
| 184 |
type: str |
| 185 |
description: Image base64. |
| 186 |
clearpass_spt: |
| 187 |
aliases: ['clearpass-spt'] |
| 188 |
type: str |
| 189 |
description: Clearpass spt. |
| 190 |
choices: ['unknown', 'healthy', 'quarantine', 'checkup', 'transition', |
| 191 |
'infected', 'transient'] |
| 192 |
fsso_group: |
| 193 |
aliases: ['fsso-group'] |
| 194 |
type: raw |
| 195 |
description: (list or str) Fsso group. |
| 196 |
sub_type: |
| 197 |
aliases: ['sub-type'] |
| 198 |
type: str |
| 199 |
description: Sub type. |
| 200 |
choices: ['sdn', 'clearpass-spt', 'fsso', 'ems-tag', 'swc-tag', |
| 201 |
'fortivoice-tag', 'fortinac-tag', 'fortipolicy-tag', |
| 202 |
'device-identification', 'rsso', 'external-resource', |
| 203 |
'obsolete', 'telemetry'] |
| 204 |
global_object: |
| 205 |
aliases: ['global-object'] |
| 206 |
type: int |
| 207 |
description: Global object. |
| 208 |
obj_tag: |
| 209 |
aliases: ['obj-tag'] |
| 210 |
type: str |
| 211 |
description: Obj tag. |
| 212 |
obj_type: |
| 213 |
aliases: ['obj-type'] |
| 214 |
type: str |
| 215 |
description: Obj type. |
| 216 |
choices: ['ip', 'mac'] |
| 217 |
fabric_object: |
| 218 |
aliases: ['fabric-object'] |
| 219 |
type: str |
| 220 |
description: Security Fabric global object setting. |
| 221 |
choices: ['disable', 'enable'] |
| 222 |
macaddr: |
| 223 |
type: raw |
| 224 |
description: (list) Multiple MAC address ranges. |
| 225 |
node_ip_only: |
| 226 |
aliases: ['node-ip-only'] |
| 227 |
type: str |
| 228 |
description: Enable/disable collection of node addresses only in Kubernetes. |
| 229 |
choices: ['disable', 'enable'] |
| 230 |
dirty: |
| 231 |
type: str |
| 232 |
description: To be deleted address. |
| 233 |
choices: ['dirty', 'clean'] |
| 234 |
pattern_end: |
| 235 |
aliases: ['pattern-end'] |
| 236 |
type: int |
| 237 |
description: Pattern end. |
| 238 |
pattern_start: |
| 239 |
aliases: ['pattern-start'] |
| 240 |
type: int |
| 241 |
description: Pattern start. |
| 242 |
tag_detection_level: |
| 243 |
aliases: ['tag-detection-level'] |
| 244 |
type: str |
| 245 |
description: Tag detection level of dynamic address object. |
| 246 |
tag_type: |
| 247 |
aliases: ['tag-type'] |
| 248 |
type: str |
| 249 |
description: Tag type of dynamic address object. |
| 250 |
hw_model: |
| 251 |
aliases: ['hw-model'] |
| 252 |
type: str |
| 253 |
description: Dynamic address matching hardware model. |
| 254 |
hw_vendor: |
| 255 |
aliases: ['hw-vendor'] |
| 256 |
type: str |
| 257 |
description: Dynamic address matching hardware vendor. |
| 258 |
os: |
| 259 |
type: str |
| 260 |
description: Dynamic address matching operating system. |
| 261 |
route_tag: |
| 262 |
aliases: ['route-tag'] |
| 263 |
type: int |
| 264 |
description: Route-tag address. |
| 265 |
sw_version: |
| 266 |
aliases: ['sw-version'] |
| 267 |
type: str |
| 268 |
description: Dynamic address matching software version. |
| 269 |
sso_attribute_value: |
| 270 |
aliases: ['sso-attribute-value'] |
| 271 |
type: raw |
| 272 |
description: (list) Name |
| 273 |
agent_id: |
| 274 |
aliases: ['agent-id'] |
| 275 |
type: raw |
| 276 |
description: (list) Telemetry agent id. |
| 277 |
tag_uuid: |
| 278 |
aliases: ['tag-uuid'] |
| 279 |
type: str |
| 280 |
description: Foreign UUID of dynamic address object. |
| 281 |
passive_fqdn_learning: |
| 282 |
aliases: ['passive-fqdn-learning'] |
| 283 |
type: str |
| 284 |
description: Enable/disable passive learning of FQDNs. |
| 285 |
choices: ['disable', 'enable'] |
| 286 |
end_ip: |
| 287 |
aliases: ['end-ip'] |
| 288 |
type: str |
| 289 |
description: Final IP address |
| 290 |
epg_name: |
| 291 |
aliases: ['epg-name'] |
| 292 |
type: str |
| 293 |
description: Endpoint group name. |
| 294 |
filter: |
| 295 |
type: str |
| 296 |
description: Match criteria filter. |
| 297 |
fqdn: |
| 298 |
type: str |
| 299 |
description: Fully Qualified Domain Name address. |
| 300 |
list: |
| 301 |
type: list |
| 302 |
elements: dict |
| 303 |
description: List. |
| 304 |
suboptions: |
| 305 |
ip: |
| 306 |
type: str |
| 307 |
description: IP. |
| 308 |
net_id: |
| 309 |
aliases: ['net-id'] |
| 310 |
type: str |
| 311 |
description: Network ID. |
| 312 |
obj_id: |
| 313 |
aliases: ['obj-id'] |
| 314 |
type: str |
| 315 |
description: Object ID. |
| 316 |
name: |
| 317 |
type: str |
| 318 |
description: Address name. |
| 319 |
required: true |
| 320 |
obj_id: |
| 321 |
aliases: ['obj-id'] |
| 322 |
type: str |
| 323 |
description: Object ID for NSX. |
| 324 |
organization: |
| 325 |
type: str |
| 326 |
description: Organization domain name |
| 327 |
policy_group: |
| 328 |
aliases: ['policy-group'] |
| 329 |
type: str |
| 330 |
description: Policy group name. |
| 331 |
sdn: |
| 332 |
type: str |
| 333 |
description: SDN. |
| 334 |
choices: ['aci', 'aws', 'nsx', 'nuage', 'azure', 'gcp', 'oci', 'openstack'] |
| 335 |
sdn_tag: |
| 336 |
aliases: ['sdn-tag'] |
| 337 |
type: str |
| 338 |
description: SDN Tag. |
| 339 |
start_ip: |
| 340 |
aliases: ['start-ip'] |
| 341 |
type: str |
| 342 |
description: First IP address |
| 343 |
subnet: |
| 344 |
type: str |
| 345 |
description: IP address and subnet mask of address. |
| 346 |
subnet_name: |
| 347 |
aliases: ['subnet-name'] |
| 348 |
type: str |
| 349 |
description: Subnet name. |
| 350 |
tagging: |
| 351 |
type: list |
| 352 |
elements: dict |
| 353 |
description: Tagging. |
| 354 |
suboptions: |
| 355 |
category: |
| 356 |
type: str |
| 357 |
description: Tag category. |
| 358 |
name: |
| 359 |
type: str |
| 360 |
description: Tagging entry name. |
| 361 |
tags: |
| 362 |
type: raw |
| 363 |
description: (list) Tags. |
| 364 |
tenant: |
| 365 |
type: str |
| 366 |
description: Tenant. |
| 367 |
type: |
| 368 |
type: str |
| 369 |
description: Type of address. |
| 370 |
choices: ['ipmask', 'iprange', 'fqdn', 'wildcard', 'geography', 'url', |
| 371 |
'wildcard-fqdn', 'nsx', 'aws', 'dynamic', 'interface-subnet', 'mac', |
| 372 |
'fqdn-group', 'route-tag'] |
| 373 |
uuid: |
| 374 |
type: str |
| 375 |
description: Universally Unique Identifier |
| 376 |
visibility: |
| 377 |
type: str |
| 378 |
description: Enable/disable address visibility in the GUI. |
| 379 |
choices: ['disable', 'enable'] |
| 380 |
wildcard: |
| 381 |
type: str |
| 382 |
description: IP address and wildcard netmask. |
| 383 |
wildcard_fqdn: |
| 384 |
aliases: ['wildcard-fqdn'] |
| 385 |
type: str |
| 386 |
description: Fully Qualified Domain Name with wildcard characters. |
| 387 |
end_mac: |
| 388 |
aliases: ['end-mac'] |
| 389 |
type: str |
| 390 |
description: Last MAC address in the range. |
| 391 |
interface: |
| 392 |
type: str |
| 393 |
description: Name of interface whose IP address is to be used. |
| 394 |
sdn_addr_type: |
| 395 |
aliases: ['sdn-addr-type'] |
| 396 |
type: str |
| 397 |
description: Type of addresses to collect. |
| 398 |
choices: ['private', 'public', 'all'] |
| 399 |
start_mac: |
| 400 |
aliases: ['start-mac'] |
| 401 |
type: str |
| 402 |
description: First MAC address in the range. |
| 403 |
tags: |
| 404 |
type: str |
| 405 |
description: Names of object-tags applied to address. |
| 406 |
profile_list: |
| 407 |
aliases: ['profile-list'] |
| 408 |
type: list |
| 409 |
elements: dict |
| 410 |
description: Profile list. |
| 411 |
suboptions: |
| 412 |
profile_id: |
| 413 |
aliases: ['profile-id'] |
| 414 |
type: int |
| 415 |
description: NSX service profile ID. |
| 416 |
_image_base64: |
| 417 |
aliases: ['_image-base64'] |
| 418 |
type: str |
| 419 |
description: Image base64. |
| 420 |
clearpass_spt: |
| 421 |
aliases: ['clearpass-spt'] |
| 422 |
type: str |
| 423 |
description: SPT |
| 424 |
choices: ['unknown', 'healthy', 'quarantine', 'checkup', 'transition', 'infected', |
| 425 |
'transient'] |
| 426 |
fsso_group: |
| 427 |
aliases: ['fsso-group'] |
| 428 |
type: raw |
| 429 |
description: (list or str) FSSO group |
| 430 |
sub_type: |
| 431 |
aliases: ['sub-type'] |
| 432 |
type: str |
| 433 |
description: Sub-type of address. |
| 434 |
choices: ['sdn', 'clearpass-spt', 'fsso', 'ems-tag', 'swc-tag', 'fortivoice-tag', |
| 435 |
'fortinac-tag', 'fortipolicy-tag', 'device-identification', 'rsso', |
| 436 |
'external-resource', 'obsolete', 'telemetry'] |
| 437 |
global_object: |
| 438 |
aliases: ['global-object'] |
| 439 |
type: int |
| 440 |
description: Global Object. |
| 441 |
obj_tag: |
| 442 |
aliases: ['obj-tag'] |
| 443 |
type: str |
| 444 |
description: Tag of dynamic address object. |
| 445 |
obj_type: |
| 446 |
aliases: ['obj-type'] |
| 447 |
type: str |
| 448 |
description: Object type. |
| 449 |
choices: ['ip', 'mac'] |
| 450 |
fabric_object: |
| 451 |
aliases: ['fabric-object'] |
| 452 |
type: str |
| 453 |
description: Security Fabric global object setting. |
| 454 |
choices: ['disable', 'enable'] |
| 455 |
macaddr: |
| 456 |
type: raw |
| 457 |
description: (list) Multiple MAC address ranges. |
| 458 |
node_ip_only: |
| 459 |
aliases: ['node-ip-only'] |
| 460 |
type: str |
| 461 |
description: Enable/disable collection of node addresses only in Kubernetes. |
| 462 |
choices: ['disable', 'enable'] |
| 463 |
dirty: |
| 464 |
type: str |
| 465 |
description: To be deleted address. |
| 466 |
choices: ['dirty', 'clean'] |
| 467 |
tag_detection_level: |
| 468 |
aliases: ['tag-detection-level'] |
| 469 |
type: str |
| 470 |
description: Tag detection level of dynamic address object. |
| 471 |
tag_type: |
| 472 |
aliases: ['tag-type'] |
| 473 |
type: str |
| 474 |
description: Tag type of dynamic address object. |
| 475 |
hw_model: |
| 476 |
aliases: ['hw-model'] |
| 477 |
type: str |
| 478 |
description: Dynamic address matching hardware model. |
| 479 |
hw_vendor: |
| 480 |
aliases: ['hw-vendor'] |
| 481 |
type: str |
| 482 |
description: Dynamic address matching hardware vendor. |
| 483 |
os: |
| 484 |
type: str |
| 485 |
description: Dynamic address matching operating system. |
| 486 |
route_tag: |
| 487 |
aliases: ['route-tag'] |
| 488 |
type: int |
| 489 |
description: Route-tag address. |
| 490 |
sw_version: |
| 491 |
aliases: ['sw-version'] |
| 492 |
type: str |
| 493 |
description: Dynamic address matching software version. |
| 494 |
sso_attribute_value: |
| 495 |
aliases: ['sso-attribute-value'] |
| 496 |
type: raw |
| 497 |
description: (list) Name |
| 498 |
pattern_end: |
| 499 |
aliases: ['pattern-end'] |
| 500 |
type: int |
| 501 |
description: Ending number of pattern for fqdn-group. |
| 502 |
pattern_start: |
| 503 |
aliases: ['pattern-start'] |
| 504 |
type: int |
| 505 |
description: Starting number of pattern for fqdn-group. |
| 506 |
tag_uuid: |
| 507 |
aliases: ['tag-uuid'] |
| 508 |
type: str |
| 509 |
description: Foreign UUID of dynamic address object. |
| 510 |
agent_id: |
| 511 |
aliases: ['agent-id'] |
| 512 |
type: raw |
| 513 |
description: (list) Telemetry agent id. |
| 514 |
passive_fqdn_learning: |
| 515 |
aliases: ['passive-fqdn-learning'] |
| 516 |
type: str |
| 517 |
description: Enable/disable passive learning of FQDNs. |
| 518 |
choices: ['disable', 'enable'] |
| 519 |
''' |
| 520 |
|
| 521 |
EXAMPLES = ''' |
| 522 |
- name: Example playbook |
| 523 |
hosts: fortimanagers |
| 524 |
gather_facts: false |
| 525 |
connection: httpapi |
| 526 |
vars: |
| 527 |
ansible_httpapi_use_ssl: true |
| 528 |
ansible_httpapi_validate_certs: false |
| 529 |
ansible_httpapi_port: 443 |
| 530 |
tasks: |
| 531 |
- name: Configure IPv4 addresses. |
| 532 |
fortinet.fortimanager.fmgr_firewall_address: |
| 533 |
bypass_validation: false |
| 534 |
adom: root |
| 535 |
state: present |
| 536 |
firewall_address: |
| 537 |
name: "ansible-test1" |
| 538 |
allow_routing: disable |
| 539 |
associated_interface: any |
| 540 |
|
| 541 |
- name: Gathering fortimanager facts |
| 542 |
hosts: fortimanagers |
| 543 |
gather_facts: false |
| 544 |
connection: httpapi |
| 545 |
vars: |
| 546 |
ansible_httpapi_use_ssl: true |
| 547 |
ansible_httpapi_validate_certs: false |
| 548 |
ansible_httpapi_port: 443 |
| 549 |
tasks: |
| 550 |
- name: Retrieve all the IPv4 addresses |
| 551 |
fortinet.fortimanager.fmgr_fact: |
| 552 |
facts: |
| 553 |
selector: "firewall_address" |
| 554 |
params: |
| 555 |
adom: "ansible" |
| 556 |
address: "your_value" |
| 557 |
|
| 558 |
- name: Example playbook |
| 559 |
hosts: fortimanagers |
| 560 |
gather_facts: false |
| 561 |
connection: httpapi |
| 562 |
vars: |
| 563 |
ansible_httpapi_use_ssl: true |
| 564 |
ansible_httpapi_validate_certs: false |
| 565 |
ansible_httpapi_port: 443 |
| 566 |
tasks: |
| 567 |
- name: Configure IPv4 addresses. |
| 568 |
fortinet.fortimanager.fmgr_firewall_address: |
| 569 |
bypass_validation: false |
| 570 |
adom: root |
| 571 |
state: present |
| 572 |
firewall_address: |
| 573 |
allow_routing: disable |
| 574 |
associated_interface: any |
| 575 |
name: "address-orignal" |
| 576 |
# visibility: enable |
| 577 |
- name: Rename the firewall addressobject |
| 578 |
fortinet.fortimanager.fmgr_rename: |
| 579 |
rename: |
| 580 |
selector: "firewall_address" |
| 581 |
self: |
| 582 |
adom: "root" |
| 583 |
address: "address-orignal" |
| 584 |
target: |
| 585 |
name: "address-new" |
| 586 |
- name: Delete renamed object |
| 587 |
fortinet.fortimanager.fmgr_firewall_address: |
| 588 |
adom: "root" |
| 589 |
state: absent |
| 590 |
firewall_address: |
| 591 |
name: "address-new" |
| 592 |
''' |
| 593 |
|
| 594 |
RETURN = ''' |
| 595 |
meta: |
| 596 |
description: The result of the request. |
| 597 |
type: dict |
| 598 |
returned: always |
| 599 |
contains: |
| 600 |
request_url: |
| 601 |
description: The full url requested. |
| 602 |
returned: always |
| 603 |
type: str |
| 604 |
sample: /sys/login/user |
| 605 |
response_code: |
| 606 |
description: The status of api request. |
| 607 |
returned: always |
| 608 |
type: int |
| 609 |
sample: 0 |
| 610 |
response_data: |
| 611 |
description: The api response. |
| 612 |
type: list |
| 613 |
returned: always |
| 614 |
response_message: |
| 615 |
description: The descriptive message of the api response. |
| 616 |
type: str |
| 617 |
returned: always |
| 618 |
sample: OK. |
| 619 |
system_information: |
| 620 |
description: The information of the target system. |
| 621 |
type: dict |
| 622 |
returned: always |
| 623 |
rc: |
| 624 |
description: The status the request. |
| 625 |
type: int |
| 626 |
returned: always |
| 627 |
sample: 0 |
| 628 |
version_check_warning: |
| 629 |
description: Warning if the parameters used in the playbook are not supported by the current FortiManager version. |
| 630 |
type: list |
| 631 |
returned: complex |
| 632 |
''' |
| 633 |
from ansible.module_utils.basic import AnsibleModule |
| 634 |
from ansible.module_utils.connection import Connection |
| 635 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass |
| 636 |
from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec |
| 637 |
|
| 638 |
|
| 639 |
def main(): |
| 640 |
urls_list = [ |
| 641 |
'/pm/config/adom/{adom}/obj/firewall/address', |
| 642 |
'/pm/config/global/obj/firewall/address' |
| 643 |
] |
| 644 |
module_arg_spec = { |
| 645 |
'adom': {'required': True, 'type': 'str'}, |
| 646 |
'revision_note': {'type': 'str'}, |
| 647 |
'firewall_address': { |
| 648 |
'type': 'dict', 'v_range': [['6.0.0', '']], |
| 649 |
'options': { |
| 650 |
'allow-routing': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 651 |
'associated-interface': {'type': 'str'}, |
| 652 |
'cache-ttl': {'type': 'int'}, |
| 653 |
'color': {'type': 'int'}, |
| 654 |
'comment': {'type': 'raw'}, |
| 655 |
'country': {'type': 'str'}, |
| 656 |
'dynamic_mapping': { |
| 657 |
'type': 'list', |
| 658 |
'options': { |
| 659 |
'_scope': {'type': 'list', 'options': {'name': {'type': 'str'}, 'vdom': {'type': 'str'}}, 'elements': 'dict'}, |
| 660 |
'allow-routing': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 661 |
'associated-interface': {'type': 'str'}, |
| 662 |
'cache-ttl': {'type': 'int'}, |
| 663 |
'color': {'type': 'int'}, |
| 664 |
'comment': {'type': 'raw'}, |
| 665 |
'country': {'type': 'str'}, |
| 666 |
'end-ip': {'type': 'str'}, |
| 667 |
'end-mac': {'type': 'str'}, |
| 668 |
'epg-name': {'type': 'str'}, |
| 669 |
'filter': {'type': 'str'}, |
| 670 |
'fqdn': {'type': 'str'}, |
| 671 |
'interface': {'type': 'str'}, |
| 672 |
'obj-id': {'type': 'str'}, |
| 673 |
'organization': {'type': 'str'}, |
| 674 |
'policy-group': {'type': 'str'}, |
| 675 |
'sdn': {'choices': ['aci', 'aws', 'nsx', 'nuage', 'azure', 'gcp', 'oci', 'openstack'], 'type': 'str'}, |
| 676 |
'sdn-addr-type': {'choices': ['private', 'public', 'all'], 'type': 'str'}, |
| 677 |
'sdn-tag': {'type': 'str'}, |
| 678 |
'start-ip': {'type': 'str'}, |
| 679 |
'start-mac': {'type': 'str'}, |
| 680 |
'subnet': {'type': 'str'}, |
| 681 |
'subnet-name': {'type': 'str'}, |
| 682 |
'tags': {'type': 'raw'}, |
| 683 |
'tenant': {'type': 'str'}, |
| 684 |
'type': { |
| 685 |
'choices': [ |
| 686 |
'ipmask', 'iprange', 'fqdn', 'wildcard', 'geography', 'url', 'wildcard-fqdn', 'nsx', 'aws', 'dynamic', |
| 687 |
'interface-subnet', 'mac', 'fqdn-group', 'route-tag' |
| 688 |
], |
| 689 |
'type': 'str' |
| 690 |
}, |
| 691 |
'url': {'type': 'str'}, |
| 692 |
'uuid': {'type': 'str'}, |
| 693 |
'visibility': {'choices': ['disable', 'enable'], 'type': 'str'}, |
| 694 |
'wildcard': {'type': 'str'}, |
| 695 |
'wildcard-fqdn': {'type': 'str'}, |
| 696 |
'_image-base64': {'v_range': [['6.2.2', '']], 'type': 'str'}, |
| 697 |
'clearpass-spt': { |
| 698 |
'v_range': [['6.2.2', '']], |
| 699 |
'choices': ['unknown', 'healthy', 'quarantine', 'checkup', 'transition', 'infected', 'transient'], |
| 700 |
'type': 'str' |
| 701 |
}, |
| 702 |
'fsso-group': {'v_range': [['6.2.2', '']], 'type': 'raw'}, |
| 703 |
'sub-type': { |
| 704 |
'v_range': [['6.2.2', '']], |
| 705 |
'choices': [ |
| 706 |
'sdn', 'clearpass-spt', 'fsso', 'ems-tag', 'swc-tag', 'fortivoice-tag', 'fortinac-tag', 'fortipolicy-tag', |
| 707 |
'device-identification', 'rsso', 'external-resource', 'obsolete', 'telemetry' |
| 708 |
], |
| 709 |
'type': 'str' |
| 710 |
}, |
| 711 |
'global-object': {'v_range': [['6.4.0', '']], 'type': 'int'}, |
| 712 |
'obj-tag': {'v_range': [['6.4.2', '']], 'type': 'str'}, |
| 713 |
'obj-type': {'v_range': [['6.4.2', '']], 'choices': ['ip', 'mac'], 'type': 'str'}, |
| 714 |
'fabric-object': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 715 |
'macaddr': {'v_range': [['7.0.0', '']], 'type': 'raw'}, |
| 716 |
'node-ip-only': {'v_range': [['7.0.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 717 |
'dirty': {'v_range': [['7.0.3', '']], 'choices': ['dirty', 'clean'], 'type': 'str'}, |
| 718 |
'pattern-end': {'v_range': [['7.0.3', '']], 'type': 'int'}, |
| 719 |
'pattern-start': {'v_range': [['7.0.3', '']], 'type': 'int'}, |
| 720 |
'tag-detection-level': {'v_range': [['7.0.3', '']], 'type': 'str'}, |
| 721 |
'tag-type': {'v_range': [['7.0.3', '']], 'type': 'str'}, |
| 722 |
'hw-model': {'v_range': [['7.4.0', '']], 'type': 'str'}, |
| 723 |
'hw-vendor': {'v_range': [['7.4.0', '']], 'type': 'str'}, |
| 724 |
'os': {'v_range': [['7.4.0', '']], 'type': 'str'}, |
| 725 |
'route-tag': {'v_range': [['7.4.0', '']], 'type': 'int'}, |
| 726 |
'sw-version': {'v_range': [['7.4.0', '']], 'type': 'str'}, |
| 727 |
'sso-attribute-value': {'v_range': [['7.6.2', '']], 'type': 'raw'}, |
| 728 |
'agent-id': {'v_range': [['7.6.4', '']], 'type': 'raw'}, |
| 729 |
'tag-uuid': {'v_range': [['7.6.4', '']], 'type': 'str'}, |
| 730 |
'passive-fqdn-learning': {'v_range': [['7.6.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'} |
| 731 |
}, |
| 732 |
'elements': 'dict' |
| 733 |
}, |
| 734 |
'end-ip': {'type': 'str'}, |
| 735 |
'epg-name': {'type': 'str'}, |
| 736 |
'filter': {'type': 'str'}, |
| 737 |
'fqdn': {'type': 'str'}, |
| 738 |
'list': { |
| 739 |
'type': 'list', |
| 740 |
'options': { |
| 741 |
'ip': {'type': 'str'}, |
| 742 |
'net-id': {'v_range': [['6.2.0', '']], 'type': 'str'}, |
| 743 |
'obj-id': {'v_range': [['6.2.0', '']], 'type': 'str'} |
| 744 |
}, |
| 745 |
'elements': 'dict' |
| 746 |
}, |
| 747 |
'name': {'required': True, 'type': 'str'}, |
| 748 |
'obj-id': {'type': 'str'}, |
| 749 |
'organization': {'type': 'str'}, |
| 750 |
'policy-group': {'type': 'str'}, |
| 751 |
'sdn': {'choices': ['aci', 'aws', 'nsx', 'nuage', 'azure', 'gcp', 'oci', 'openstack'], 'type': 'str'}, |
| 752 |
'sdn-tag': {'type': 'str'}, |
| 753 |
'start-ip': {'type': 'str'}, |
| 754 |
'subnet': {'type': 'str'}, |
| 755 |
'subnet-name': {'type': 'str'}, |
| 756 |
'tagging': { |
| 757 |
'type': 'list', |
| 758 |
'options': {'category': {'type': 'str'}, 'name': {'type': 'str'}, 'tags': {'type': 'raw'}}, |
| 759 |
'elements': 'dict' |
| 760 |
}, |
| 761 |
'tenant': {'type': 'str'}, |
| 762 |
'type': { |
| 763 |
'choices': [ |
| 764 |
'ipmask', 'iprange', 'fqdn', 'wildcard', 'geography', 'url', 'wildcard-fqdn', 'nsx', 'aws', 'dynamic', 'interface-subnet', 'mac', |
| 765 |
'fqdn-group', 'route-tag' |
| 766 |
], |
| 767 |
'type': 'str' |
| 768 |
}, |
| 769 |
'uuid': {'type': 'str'}, |
| 770 |
'visibility': {'v_range': [['6.0.0', '7.6.2']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 771 |
'wildcard': {'type': 'str'}, |
| 772 |
'wildcard-fqdn': {'type': 'str'}, |
| 773 |
'end-mac': {'v_range': [['6.2.0', '']], 'type': 'str'}, |
| 774 |
'interface': {'v_range': [['6.2.0', '']], 'type': 'str'}, |
| 775 |
'sdn-addr-type': {'v_range': [['6.2.0', '']], 'choices': ['private', 'public', 'all'], 'type': 'str'}, |
| 776 |
'start-mac': {'v_range': [['6.2.0', '']], 'type': 'str'}, |
| 777 |
'tags': {'v_range': [['6.2.0', '6.4.15'], ['7.4.8', '7.4.10']], 'type': 'str'}, |
| 778 |
'profile-list': { |
| 779 |
'v_range': [['6.2.0', '6.2.13']], |
| 780 |
'type': 'list', |
| 781 |
'options': {'profile-id': {'v_range': [['6.2.0', '6.2.13']], 'type': 'int'}}, |
| 782 |
'elements': 'dict' |
| 783 |
}, |
| 784 |
'_image-base64': {'v_range': [['6.2.2', '']], 'type': 'str'}, |
| 785 |
'clearpass-spt': { |
| 786 |
'v_range': [['6.2.2', '']], |
| 787 |
'choices': ['unknown', 'healthy', 'quarantine', 'checkup', 'transition', 'infected', 'transient'], |
| 788 |
'type': 'str' |
| 789 |
}, |
| 790 |
'fsso-group': {'v_range': [['6.2.2', '']], 'type': 'raw'}, |
| 791 |
'sub-type': { |
| 792 |
'v_range': [['6.2.2', '']], |
| 793 |
'choices': [ |
| 794 |
'sdn', 'clearpass-spt', 'fsso', 'ems-tag', 'swc-tag', 'fortivoice-tag', 'fortinac-tag', 'fortipolicy-tag', |
| 795 |
'device-identification', 'rsso', 'external-resource', 'obsolete', 'telemetry' |
| 796 |
], |
| 797 |
'type': 'str' |
| 798 |
}, |
| 799 |
'global-object': {'v_range': [['6.4.0', '']], 'type': 'int'}, |
| 800 |
'obj-tag': {'v_range': [['6.4.2', '']], 'type': 'str'}, |
| 801 |
'obj-type': {'v_range': [['6.4.2', '']], 'choices': ['ip', 'mac'], 'type': 'str'}, |
| 802 |
'fabric-object': {'v_range': [['6.4.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 803 |
'macaddr': {'v_range': [['7.0.0', '']], 'type': 'raw'}, |
| 804 |
'node-ip-only': {'v_range': [['7.0.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'}, |
| 805 |
'dirty': {'v_range': [['7.0.3', '']], 'choices': ['dirty', 'clean'], 'type': 'str'}, |
| 806 |
'tag-detection-level': {'v_range': [['7.0.3', '']], 'type': 'str'}, |
| 807 |
'tag-type': {'v_range': [['7.0.3', '']], 'type': 'str'}, |
| 808 |
'hw-model': {'v_range': [['7.4.0', '']], 'type': 'str'}, |
| 809 |
'hw-vendor': {'v_range': [['7.4.0', '']], 'type': 'str'}, |
| 810 |
'os': {'v_range': [['7.4.0', '']], 'type': 'str'}, |
| 811 |
'route-tag': {'v_range': [['7.4.0', '']], 'type': 'int'}, |
| 812 |
'sw-version': {'v_range': [['7.4.0', '']], 'type': 'str'}, |
| 813 |
'sso-attribute-value': {'v_range': [['7.6.2', '']], 'type': 'raw'}, |
| 814 |
'pattern-end': {'v_range': [['7.4.8', '7.4.10'], ['7.6.4', '']], 'type': 'int'}, |
| 815 |
'pattern-start': {'v_range': [['7.4.8', '7.4.10'], ['7.6.4', '']], 'type': 'int'}, |
| 816 |
'tag-uuid': {'v_range': [['7.6.4', '']], 'type': 'str'}, |
| 817 |
'agent-id': {'v_range': [['7.6.4', '']], 'type': 'raw'}, |
| 818 |
'passive-fqdn-learning': {'v_range': [['7.6.5', '']], 'choices': ['disable', 'enable'], 'type': 'str'} |
| 819 |
} |
| 820 |
} |
| 821 |
} |
| 822 |
|
| 823 |
module_option_spec = get_module_arg_spec('full crud') |
| 824 |
module_arg_spec.update(module_option_spec) |
| 825 |
check_galaxy_version(module_arg_spec) |
| 826 |
module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_address'), |
| 827 |
supports_check_mode=True) |
| 828 |
if not module._socket_path: |
| 829 |
module.fail_json(msg='MUST RUN IN HTTPAPI MODE') |
| 830 |
connection = Connection(module._socket_path) |
| 831 |
fmgr = NAPIManager('full crud', module_arg_spec, urls_list, |
| 832 |
'name', 'data', module, connection) |
| 833 |
fmgr.process_crud() |
| 834 |
module.exit_json(meta=module.params) |
| 835 |
|
| 836 |
|
| 837 |
if __name__ == '__main__': |
| 838 |
main() |