| 1 |
#!/usr/bin/python |
| 2 |
# -*- coding: utf-8 -*- |
| 3 |
# Copyright 2021 Red Hat |
| 4 |
# GNU General Public License v3.0+ |
| 5 |
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) |
| 6 |
|
| 7 |
""" |
| 8 |
The module file for nxos_logging_global |
| 9 |
""" |
| 10 |
|
| 11 |
from __future__ import absolute_import, division, print_function |
| 12 |
|
| 13 |
|
| 14 |
__metaclass__ = type |
| 15 |
|
| 16 |
DOCUMENTATION = """ |
| 17 |
module: nxos_logging_global |
| 18 |
short_description: Logging resource module. |
| 19 |
description: |
| 20 |
- This module manages logging configuration on devices running Cisco NX-OS. |
| 21 |
version_added: 2.5.0 |
| 22 |
notes: |
| 23 |
- Tested against NX-OS 9.3.6 on Cisco Nexus Switches. |
| 24 |
- Limited Support for Cisco MDS |
| 25 |
- This module works with connection C(network_cli) and C(httpapi). |
| 26 |
- Tested against Cisco MDS NX-OS 9.2(2) with connection C(network_cli). |
| 27 |
author: Nilashish Chakraborty (@NilashishC) |
| 28 |
options: |
| 29 |
running_config: |
| 30 |
description: |
| 31 |
- This option is used only with state I(parsed). |
| 32 |
- The value of this option should be the output received from the NX-OS device |
| 33 |
by executing the command B(show running-config | include logging). |
| 34 |
- The state I(parsed) reads the configuration from C(running_config) option and |
| 35 |
transforms it into Ansible structured data as per the resource module's argspec |
| 36 |
and the value is then returned in the I(parsed) key within the result. |
| 37 |
type: str |
| 38 |
config: |
| 39 |
description: A dictionary of logging configuration. |
| 40 |
type: dict |
| 41 |
suboptions: |
| 42 |
console: |
| 43 |
description: Set console logging parameters. |
| 44 |
type: dict |
| 45 |
suboptions: |
| 46 |
state: |
| 47 |
description: Enable or disable monitor logging. |
| 48 |
type: str |
| 49 |
choices: ["enabled", "disabled"] |
| 50 |
severity: &sev |
| 51 |
description: Set severity severity for console. |
| 52 |
type: str |
| 53 |
choices: |
| 54 |
- emergency |
| 55 |
- alert |
| 56 |
- critical |
| 57 |
- error |
| 58 |
- warning |
| 59 |
- notification |
| 60 |
- informational |
| 61 |
- debugging |
| 62 |
event: |
| 63 |
description: Interface events. |
| 64 |
type: dict |
| 65 |
suboptions: |
| 66 |
link_status: |
| 67 |
description: UPDOWN and CHANGE messages. |
| 68 |
type: dict |
| 69 |
suboptions: &event |
| 70 |
enable: |
| 71 |
description: To enable logging overriding port severity configuration. |
| 72 |
type: bool |
| 73 |
default: |
| 74 |
description: Default logging configuration used by interfaces not explicitly configured. |
| 75 |
type: bool |
| 76 |
trunk_status: |
| 77 |
description: TRUNK status messages. |
| 78 |
type: dict |
| 79 |
suboptions: *event |
| 80 |
history: |
| 81 |
description: Modifies severity severity or size for history table. |
| 82 |
type: dict |
| 83 |
suboptions: |
| 84 |
severity: *sev |
| 85 |
size: |
| 86 |
description: Set history table size. |
| 87 |
type: int |
| 88 |
ip: |
| 89 |
description: |
| 90 |
- IP configuration. |
| 91 |
- This option is unsupported on MDS switches. |
| 92 |
type: dict |
| 93 |
suboptions: |
| 94 |
access_list: |
| 95 |
description: Access-List. |
| 96 |
type: dict |
| 97 |
suboptions: |
| 98 |
cache: |
| 99 |
description: Set caching settings. |
| 100 |
type: dict |
| 101 |
suboptions: |
| 102 |
entries: |
| 103 |
description: Maximum number of log entries cached in software. |
| 104 |
type: int |
| 105 |
interval: |
| 106 |
description: Log-update interval (in sec). |
| 107 |
type: int |
| 108 |
threshold: |
| 109 |
description: Log-update threshold (number of hits) |
| 110 |
type: int |
| 111 |
detailed: |
| 112 |
description: Detailed ACL information. |
| 113 |
type: bool |
| 114 |
include: |
| 115 |
description: Include additional fields in syslogs. |
| 116 |
type: dict |
| 117 |
suboptions: |
| 118 |
sgt: |
| 119 |
description: Include source group tag info in syslogs. |
| 120 |
type: bool |
| 121 |
facilities: |
| 122 |
description: Facility parameter for syslog messages. |
| 123 |
type: list |
| 124 |
elements: dict |
| 125 |
suboptions: |
| 126 |
facility: |
| 127 |
description: Facility name. |
| 128 |
type: str |
| 129 |
severity: *sev |
| 130 |
logfile: |
| 131 |
description: Set file logging. |
| 132 |
type: dict |
| 133 |
suboptions: |
| 134 |
state: |
| 135 |
description: Enable or disable logfile. |
| 136 |
type: str |
| 137 |
choices: ["enabled", "disabled"] |
| 138 |
name: |
| 139 |
description: Logfile name. |
| 140 |
type: str |
| 141 |
severity: *sev |
| 142 |
persistent_threshold: |
| 143 |
description: |
| 144 |
- Set persistent logging utilization alert threshold in percentage. |
| 145 |
- This option is unsupported on MDS switches. |
| 146 |
type: int |
| 147 |
size: |
| 148 |
description: Enter the logfile size in bytes. |
| 149 |
type: int |
| 150 |
module: |
| 151 |
description: Set module(linecard) logging. |
| 152 |
type: dict |
| 153 |
suboptions: |
| 154 |
state: |
| 155 |
description: Enable or disable module logging. |
| 156 |
type: str |
| 157 |
choices: ["enabled", "disabled"] |
| 158 |
severity: *sev |
| 159 |
monitor: |
| 160 |
description: Set terminal line(monitor) logging severity. |
| 161 |
type: dict |
| 162 |
suboptions: |
| 163 |
state: |
| 164 |
description: Enable or disable monitor logging. |
| 165 |
type: str |
| 166 |
choices: ["enabled", "disabled"] |
| 167 |
severity: *sev |
| 168 |
origin_id: |
| 169 |
description: Enable origin information for Remote Syslog Server. |
| 170 |
type: dict |
| 171 |
suboptions: |
| 172 |
hostname: |
| 173 |
description: |
| 174 |
- Use hostname as origin-id of logging messages. |
| 175 |
- This option is mutually exclusive with I(ip) and I(string). |
| 176 |
type: bool |
| 177 |
ip: |
| 178 |
description: |
| 179 |
- Use ip address as origin-id of logging messages. |
| 180 |
- This option is mutually exclusive with I(hostname) and I(string). |
| 181 |
type: str |
| 182 |
string: |
| 183 |
description: |
| 184 |
- Use text string as origin-id of logging messages. |
| 185 |
- This option is mutually exclusive with I(hostname) and I(ip). |
| 186 |
type: str |
| 187 |
rate_limit: |
| 188 |
description: Enable or disable rate limit for log messages. |
| 189 |
type: str |
| 190 |
choices: ["enabled", "disabled"] |
| 191 |
rfc_strict: |
| 192 |
description: |
| 193 |
- Set RFC to which messages should compliant. |
| 194 |
- Syslogs will be compliant to RFC 5424. |
| 195 |
- This option is unsupported on MDS switches. |
| 196 |
type: bool |
| 197 |
hosts: |
| 198 |
description: Enable forwarding to Remote Syslog Servers. |
| 199 |
type: list |
| 200 |
elements: dict |
| 201 |
suboptions: |
| 202 |
host: |
| 203 |
description: Hostname/IPv4/IPv6 address of the Remote Syslog Server. |
| 204 |
type: str |
| 205 |
severity: *sev |
| 206 |
facility: |
| 207 |
description: Facility to use when forwarding to server. |
| 208 |
type: str |
| 209 |
port: |
| 210 |
description: Destination Port when forwarding to remote server. |
| 211 |
type: int |
| 212 |
secure: |
| 213 |
description: Enable secure connection to remote server. |
| 214 |
type: dict |
| 215 |
suboptions: |
| 216 |
trustpoint: |
| 217 |
description: Trustpoint configuration. |
| 218 |
type: dict |
| 219 |
suboptions: |
| 220 |
client_identity: |
| 221 |
description: |
| 222 |
- Client Identity certificate for mutual authentication. |
| 223 |
- Trustpoint to use for client certificate authentication. |
| 224 |
type: str |
| 225 |
use_vrf: |
| 226 |
description: |
| 227 |
- Display per-VRF information. |
| 228 |
- This option is unsupported on MDS switches. |
| 229 |
type: str |
| 230 |
source_interface: |
| 231 |
description: |
| 232 |
- Enable Source-Interface for Remote Syslog Server. |
| 233 |
- This option is unsupported on MDS switches. |
| 234 |
type: str |
| 235 |
timestamp: |
| 236 |
description: Set logging timestamp granularity. |
| 237 |
type: str |
| 238 |
choices: ["microseconds", "milliseconds", "seconds"] |
| 239 |
state: |
| 240 |
description: |
| 241 |
- The state the configuration should be left in. |
| 242 |
- The states I(replaced) and I(overridden) have identical |
| 243 |
behaviour for this module. |
| 244 |
- Refer to examples for more details. |
| 245 |
type: str |
| 246 |
choices: |
| 247 |
- merged |
| 248 |
- replaced |
| 249 |
- overridden |
| 250 |
- deleted |
| 251 |
- parsed |
| 252 |
- gathered |
| 253 |
- rendered |
| 254 |
default: merged |
| 255 |
""" |
| 256 |
EXAMPLES = """ |
| 257 |
# Using merged |
| 258 |
|
| 259 |
# Before state: |
| 260 |
# ------------- |
| 261 |
# nxos-9k-rdo# show running-config | include logging |
| 262 |
# nxos-9k-rdo# |
| 263 |
|
| 264 |
- name: Merge the provided configuration with the existing running configuration |
| 265 |
cisco.nxos.nxos_logging_global: |
| 266 |
config: |
| 267 |
console: |
| 268 |
severity: error |
| 269 |
monitor: |
| 270 |
severity: warning |
| 271 |
ip: |
| 272 |
access_list: |
| 273 |
cache: |
| 274 |
entries: 16384 |
| 275 |
interval: 200 |
| 276 |
threshold: 5000 |
| 277 |
facilities: |
| 278 |
- facility: auth |
| 279 |
severity: critical |
| 280 |
- facility: ospfv3 |
| 281 |
severity: alert |
| 282 |
- facility: ftp |
| 283 |
severity: informational |
| 284 |
hosts: |
| 285 |
- host: 203.0.113.100 |
| 286 |
severity: alert |
| 287 |
use_vrf: management |
| 288 |
- host: 203.0.113.101 |
| 289 |
severity: error |
| 290 |
facility: local6 |
| 291 |
use_vrf: default |
| 292 |
origin_id: |
| 293 |
hostname: true |
| 294 |
|
| 295 |
# Task output |
| 296 |
# ------------- |
| 297 |
# before: {} |
| 298 |
# |
| 299 |
# commands: |
| 300 |
# - "logging console 3" |
| 301 |
# - "logging monitor 4" |
| 302 |
# - "logging ip access-list cache entries 16384" |
| 303 |
# - "logging ip access-list cache interval 200" |
| 304 |
# - "logging ip access-list cache threshold 5000" |
| 305 |
# - "logging severity auth 2" |
| 306 |
# - "logging severity ospfv3 1" |
| 307 |
# - "logging severity ftp 6" |
| 308 |
# - "logging server 203.0.113.100 1 use-vrf management" |
| 309 |
# - "logging server 203.0.113.101 3 facility local6 use-vrf default" |
| 310 |
# - "logging origin-id hostname" |
| 311 |
# |
| 312 |
# after: |
| 313 |
# console: |
| 314 |
# severity: error |
| 315 |
# facilities: |
| 316 |
# - facility: auth |
| 317 |
# severity: critical |
| 318 |
# - facility: ftp |
| 319 |
# severity: informational |
| 320 |
# - facility: ospfv3 |
| 321 |
# severity: alert |
| 322 |
# ip: |
| 323 |
# access_list: |
| 324 |
# cache: |
| 325 |
# entries: 16384 |
| 326 |
# interval: 200 |
| 327 |
# threshold: 5000 |
| 328 |
# monitor: |
| 329 |
# severity: warning |
| 330 |
# origin_id: |
| 331 |
# hostname: true |
| 332 |
# hosts: |
| 333 |
# - severity: alert |
| 334 |
# host: 203.0.113.100 |
| 335 |
# use_vrf: management |
| 336 |
# - facility: local6 |
| 337 |
# severity: error |
| 338 |
# host: 203.0.113.101 |
| 339 |
# use_vrf: default |
| 340 |
|
| 341 |
# After state: |
| 342 |
# ------------ |
| 343 |
# nxos-9k-rdo# show running-config | include logging |
| 344 |
# logging console 3 |
| 345 |
# logging monitor 4 |
| 346 |
# logging ip access-list cache entries 16384 |
| 347 |
# logging ip access-list cache interval 200 |
| 348 |
# logging ip access-list cache threshold 5000 |
| 349 |
# logging severity auth 2 |
| 350 |
# logging severity ospfv3 1 |
| 351 |
# logging severity ftp 6 |
| 352 |
# logging origin-id hostname |
| 353 |
# logging server 203.0.113.100 1 use-vrf management |
| 354 |
# logging server 203.0.113.101 3 use-vrf default facility local6 |
| 355 |
|
| 356 |
# Using replaced |
| 357 |
|
| 358 |
# Before state: |
| 359 |
# ------------ |
| 360 |
# nxos-9k-rdo# show running-config | include logging |
| 361 |
# logging console 3 |
| 362 |
# logging monitor 4 |
| 363 |
# logging ip access-list cache entries 16384 |
| 364 |
# logging ip access-list cache interval 200 |
| 365 |
# logging ip access-list cache threshold 5000 |
| 366 |
# logging severity auth 2 |
| 367 |
# logging severity ospfv3 1 |
| 368 |
# logging severity ftp 6 |
| 369 |
# logging origin-id hostname |
| 370 |
# logging server 203.0.113.100 1 use-vrf management |
| 371 |
# logging server 203.0.113.101 3 use-vrf default facility local6 |
| 372 |
|
| 373 |
- name: Replace logging configurations with provided config |
| 374 |
cisco.nxos.nxos_logging_global: |
| 375 |
config: |
| 376 |
monitor: |
| 377 |
severity: warning |
| 378 |
ip: |
| 379 |
access_list: |
| 380 |
cache: |
| 381 |
entries: 4096 |
| 382 |
facilities: |
| 383 |
- facility: auth |
| 384 |
severity: critical |
| 385 |
- facility: ospfv3 |
| 386 |
severity: alert |
| 387 |
- facility: ftp |
| 388 |
severity: informational |
| 389 |
hosts: |
| 390 |
- host: 203.0.113.101 |
| 391 |
severity: error |
| 392 |
facility: local6 |
| 393 |
use_vrf: default |
| 394 |
- host: 198.51.100.101 |
| 395 |
severity: alert |
| 396 |
port: 6538 |
| 397 |
use_vrf: management |
| 398 |
origin_id: |
| 399 |
ip: 192.0.2.100 |
| 400 |
state: replaced |
| 401 |
|
| 402 |
# Task output |
| 403 |
# ------------- |
| 404 |
# before: |
| 405 |
# console: |
| 406 |
# severity: error |
| 407 |
# facilities: |
| 408 |
# - facility: auth |
| 409 |
# severity: critical |
| 410 |
# - facility: ftp |
| 411 |
# severity: informational |
| 412 |
# - facility: ospfv3 |
| 413 |
# severity: alert |
| 414 |
# ip: |
| 415 |
# access_list: |
| 416 |
# cache: |
| 417 |
# entries: 16384 |
| 418 |
# interval: 200 |
| 419 |
# threshold: 5000 |
| 420 |
# monitor: |
| 421 |
# severity: warning |
| 422 |
# origin_id: |
| 423 |
# hostname: true |
| 424 |
# hosts: |
| 425 |
# - severity: alert |
| 426 |
# host: 203.0.113.100 |
| 427 |
# use_vrf: management |
| 428 |
# - facility: local6 |
| 429 |
# severity: error |
| 430 |
# host: 203.0.113.101 |
| 431 |
# use_vrf: default |
| 432 |
# |
| 433 |
# commands: |
| 434 |
# - "logging console" |
| 435 |
# - "logging ip access-list cache entries 4096" |
| 436 |
# - "no logging ip access-list cache interval 200" |
| 437 |
# - "no logging ip access-list cache threshold 5000" |
| 438 |
# - "no logging origin-id hostname" |
| 439 |
# - "logging origin-id ip 192.0.2.100" |
| 440 |
# - "logging server 198.51.100.101 1 port 6538 use-vrf management" |
| 441 |
# - "no logging server 203.0.113.100 1 use-vrf management" |
| 442 |
# |
| 443 |
# after: |
| 444 |
# facilities: |
| 445 |
# - facility: auth |
| 446 |
# severity: critical |
| 447 |
# - facility: ftp |
| 448 |
# severity: informational |
| 449 |
# - facility: ospfv3 |
| 450 |
# severity: alert |
| 451 |
# ip: |
| 452 |
# access_list: |
| 453 |
# cache: |
| 454 |
# entries: 4096 |
| 455 |
# monitor: |
| 456 |
# severity: warning |
| 457 |
# origin_id: |
| 458 |
# ip: 192.0.2.100 |
| 459 |
# hosts: |
| 460 |
# - severity: alert |
| 461 |
# port: 6538 |
| 462 |
# host: 198.51.100.101 |
| 463 |
# use_vrf: management |
| 464 |
# - facility: local6 |
| 465 |
# severity: error |
| 466 |
# host: 203.0.113.101 |
| 467 |
# use_vrf: default |
| 468 |
# |
| 469 |
# After state: |
| 470 |
# ------------ |
| 471 |
# nxos-9k-rdo# show running-config | include logging |
| 472 |
# logging monitor 4 |
| 473 |
# logging ip access-list cache entries 4096 |
| 474 |
# logging severity auth 2 |
| 475 |
# logging severity ospfv3 1 |
| 476 |
# logging severity ftp 6 |
| 477 |
# logging origin-id ip 192.0.2.100 |
| 478 |
# logging server 203.0.113.101 3 use-vrf default facility local6 |
| 479 |
# logging server 198.51.100.101 1 port 6538 use-vrf management |
| 480 |
|
| 481 |
# Using deleted to delete all logging configurations |
| 482 |
|
| 483 |
# Before state: |
| 484 |
# ------------ |
| 485 |
# nxos-9k-rdo# show running-config | include logging |
| 486 |
# logging console 3 |
| 487 |
# logging monitor 4 |
| 488 |
# logging ip access-list cache entries 16384 |
| 489 |
# logging ip access-list cache interval 200 |
| 490 |
# logging ip access-list cache threshold 5000 |
| 491 |
# logging severity auth 2 |
| 492 |
# logging severity ospfv3 1 |
| 493 |
# logging severity ftp 6 |
| 494 |
# logging origin-id hostname |
| 495 |
# logging server 203.0.113.100 1 use-vrf management |
| 496 |
# logging server 203.0.113.101 3 use-vrf default facility local6 |
| 497 |
|
| 498 |
- name: Delete all logging configuration |
| 499 |
cisco.nxos.nxos_logging_global: |
| 500 |
state: deleted |
| 501 |
|
| 502 |
# Task output |
| 503 |
# ------------- |
| 504 |
# before: |
| 505 |
# console: |
| 506 |
# severity: error |
| 507 |
# facilities: |
| 508 |
# - facility: auth |
| 509 |
# severity: critical |
| 510 |
# - facility: ftp |
| 511 |
# severity: informational |
| 512 |
# - facility: ospfv3 |
| 513 |
# severity: alert |
| 514 |
# ip: |
| 515 |
# access_list: |
| 516 |
# cache: |
| 517 |
# entries: 16384 |
| 518 |
# interval: 200 |
| 519 |
# threshold: 5000 |
| 520 |
# monitor: |
| 521 |
# severity: warning |
| 522 |
# origin_id: |
| 523 |
# hostname: true |
| 524 |
# hosts: |
| 525 |
# - severity: alert |
| 526 |
# host: 203.0.113.100 |
| 527 |
# use_vrf: management |
| 528 |
# - facility: local6 |
| 529 |
# severity: error |
| 530 |
# host: 203.0.113.101 |
| 531 |
# use_vrf: default |
| 532 |
# |
| 533 |
# commands: |
| 534 |
# - "logging console" |
| 535 |
# - "logging monitor" |
| 536 |
# - "no logging ip access-list cache entries 16384" |
| 537 |
# - "no logging ip access-list cache interval 200" |
| 538 |
# - "no logging ip access-list cache threshold 5000" |
| 539 |
# - "no logging origin-id hostname" |
| 540 |
# - "no logging severity auth 2" |
| 541 |
# - "no logging severity ospfv3 1" |
| 542 |
# - "no logging severity ftp 6" |
| 543 |
# - "no logging server 203.0.113.100 1 use-vrf management" |
| 544 |
# - "no logging server 203.0.113.101 3 facility local6 use-vrf default" |
| 545 |
# |
| 546 |
# after: {} |
| 547 |
|
| 548 |
# Using rendered |
| 549 |
|
| 550 |
- name: Render platform specific configuration lines with state rendered (without connecting to the device) |
| 551 |
cisco.nxos.nxos_logging_global: |
| 552 |
config: |
| 553 |
console: |
| 554 |
severity: error |
| 555 |
monitor: |
| 556 |
severity: warning |
| 557 |
ip: |
| 558 |
access_list: |
| 559 |
cache: |
| 560 |
entries: 16384 |
| 561 |
interval: 200 |
| 562 |
threshold: 5000 |
| 563 |
facilities: |
| 564 |
- facility: auth |
| 565 |
severity: critical |
| 566 |
- facility: ospfv3 |
| 567 |
severity: alert |
| 568 |
- facility: ftp |
| 569 |
severity: informational |
| 570 |
hosts: |
| 571 |
- host: 203.0.113.100 |
| 572 |
severity: alert |
| 573 |
use_vrf: management |
| 574 |
- host: 203.0.113.101 |
| 575 |
severity: error |
| 576 |
facility: local6 |
| 577 |
use_vrf: default |
| 578 |
origin_id: |
| 579 |
hostname: true |
| 580 |
|
| 581 |
# Task Output (redacted) |
| 582 |
# ----------------------- |
| 583 |
# rendered: |
| 584 |
# - "logging console 3" |
| 585 |
# - "logging monitor 4" |
| 586 |
# - "logging ip access-list cache entries 16384" |
| 587 |
# - "logging ip access-list cache interval 200" |
| 588 |
# - "logging ip access-list cache threshold 5000" |
| 589 |
# - "logging severity auth 2" |
| 590 |
# - "logging severity ospfv3 1" |
| 591 |
# - "logging severity ftp 6" |
| 592 |
# - "logging server 203.0.113.100 1 use-vrf management" |
| 593 |
# - "logging server 203.0.113.101 3 facility local6 use-vrf default" |
| 594 |
# - "logging origin-id hostname" |
| 595 |
|
| 596 |
# Using parsed |
| 597 |
|
| 598 |
# parsed.cfg |
| 599 |
# ------------ |
| 600 |
# logging console 3 |
| 601 |
# logging monitor 4 |
| 602 |
# logging ip access-list cache entries 16384 |
| 603 |
# logging ip access-list cache interval 200 |
| 604 |
# logging ip access-list cache threshold 5000 |
| 605 |
# logging severity auth 2 |
| 606 |
# logging severity ospfv3 1 |
| 607 |
# logging severity ftp 6 |
| 608 |
# logging origin-id hostname |
| 609 |
# logging server 203.0.113.100 1 use-vrf management |
| 610 |
# logging server 203.0.113.101 3 use-vrf default facility local6 |
| 611 |
|
| 612 |
- name: Parse externally provided logging configuration |
| 613 |
cisco.nxos.nxos_logging_global: |
| 614 |
running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" |
| 615 |
state: parsed |
| 616 |
|
| 617 |
# Task output (redacted) |
| 618 |
# ----------------------- |
| 619 |
# parsed: |
| 620 |
# console: |
| 621 |
# severity: error |
| 622 |
# facilities: |
| 623 |
# - facility: auth |
| 624 |
# severity: critical |
| 625 |
# - facility: ftp |
| 626 |
# severity: informational |
| 627 |
# - facility: ospfv3 |
| 628 |
# severity: alert |
| 629 |
# ip: |
| 630 |
# access_list: |
| 631 |
# cache: |
| 632 |
# entries: 16384 |
| 633 |
# interval: 200 |
| 634 |
# threshold: 5000 |
| 635 |
# monitor: |
| 636 |
# severity: warning |
| 637 |
# origin_id: |
| 638 |
# hostname: true |
| 639 |
# hosts: |
| 640 |
# - severity: alert |
| 641 |
# host: 203.0.113.100 |
| 642 |
# use_vrf: management |
| 643 |
# - facility: local6 |
| 644 |
# severity: error |
| 645 |
# host: 203.0.113.101 |
| 646 |
# use_vrf: default |
| 647 |
""" |
| 648 |
|
| 649 |
RETURN = """ |
| 650 |
before: |
| 651 |
description: The configuration prior to the module execution. |
| 652 |
returned: when state is I(merged), I(replaced), I(overridden), I(deleted) or I(purged) |
| 653 |
type: dict |
| 654 |
sample: > |
| 655 |
This output will always be in the same format as the |
| 656 |
module argspec. |
| 657 |
after: |
| 658 |
description: The resulting configuration after module execution. |
| 659 |
returned: when changed |
| 660 |
type: dict |
| 661 |
sample: > |
| 662 |
This output will always be in the same format as the |
| 663 |
module argspec. |
| 664 |
commands: |
| 665 |
description: The set of commands pushed to the remote device. |
| 666 |
returned: when state is I(merged), I(replaced), I(overridden), I(deleted) or I(purged) |
| 667 |
type: list |
| 668 |
sample: |
| 669 |
- "logging console 3" |
| 670 |
- "logging monitor 4" |
| 671 |
- "logging ip access-list cache entries 16384" |
| 672 |
- "logging ip access-list cache interval 200" |
| 673 |
- "logging ip access-list cache threshold 5000" |
| 674 |
rendered: |
| 675 |
description: The provided configuration in the task rendered in device-native format (offline). |
| 676 |
returned: when state is I(rendered) |
| 677 |
type: list |
| 678 |
sample: |
| 679 |
- "logging ip access-list cache entries 4096" |
| 680 |
- "no logging ip access-list cache interval 200" |
| 681 |
- "no logging ip access-list cache threshold 5000" |
| 682 |
- "no logging origin-id hostname" |
| 683 |
- "logging origin-id ip 192.0.2.100" |
| 684 |
- "logging server 198.51.100.101 1 port 6538 use-vrf management" |
| 685 |
gathered: |
| 686 |
description: Facts about the network resource gathered from the remote device as structured data. |
| 687 |
returned: when state is I(gathered) |
| 688 |
type: list |
| 689 |
sample: > |
| 690 |
This output will always be in the same format as the |
| 691 |
module argspec. |
| 692 |
parsed: |
| 693 |
description: The device native config provided in I(running_config) option parsed into structured data as per module argspec. |
| 694 |
returned: when state is I(parsed) |
| 695 |
type: list |
| 696 |
sample: > |
| 697 |
This output will always be in the same format as the |
| 698 |
module argspec. |
| 699 |
""" |
| 700 |
|
| 701 |
from ansible.module_utils.basic import AnsibleModule |
| 702 |
|
| 703 |
from ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.argspec.logging_global.logging_global import ( |
| 704 |
Logging_globalArgs, |
| 705 |
) |
| 706 |
from ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.config.logging_global.logging_global import ( |
| 707 |
Logging_global, |
| 708 |
) |
| 709 |
|
| 710 |
|
| 711 |
def main(): |
| 712 |
""" |
| 713 |
Main entry point for module execution |
| 714 |
|
| 715 |
:returns: the result form module invocation |
| 716 |
""" |
| 717 |
module = AnsibleModule( |
| 718 |
argument_spec=Logging_globalArgs.argument_spec, |
| 719 |
mutually_exclusive=[["config", "running_config"]], |
| 720 |
required_if=[ |
| 721 |
["state", "merged", ["config"]], |
| 722 |
["state", "replaced", ["config"]], |
| 723 |
["state", "overridden", ["config"]], |
| 724 |
["state", "rendered", ["config"]], |
| 725 |
["state", "parsed", ["running_config"]], |
| 726 |
], |
| 727 |
supports_check_mode=True, |
| 728 |
) |
| 729 |
|
| 730 |
result = Logging_global(module).execute_module() |
| 731 |
module.exit_json(**result) |
| 732 |
|
| 733 |
|
| 734 |
if __name__ == "__main__": |
| 735 |
main() |