Debian Codegraph @

ansible_collections/cisco/ios/plugins/modules/ios_logging_global.py

raw
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 ios_logging_global
9 """
10
11 from __future__ import absolute_import, division, print_function
12
13
14 __metaclass__ = type
15
16 DOCUMENTATION = """
17 module: ios_logging_global
18 version_added: 2.2.0
19 short_description: Resource module to configure logging.
20 description: This module manages the logging attributes of Cisco IOS network devices
21 author: Sagar Paul (@KB-perByte)
22 notes:
23 - Tested against Cisco IOSXE Version 17.3 on CML.
24 - This module works with connection C(network_cli).
25 See U(https://docs.ansible.com/ansible/latest/network/user_guide/platform_ios.html)
26 - The Configuration defaults of the Cisco IOS network devices
27 are supposed to hinder idempotent behavior of plays
28 options:
29 config:
30 description: A dictionary of logging options
31 type: dict
32 suboptions:
33 buffered:
34 description: Set buffered logging parameters
35 type: dict
36 suboptions:
37 size: &size
38 description: Logging buffer size
39 type: int
40 severity: &severity
41 description:
42 - Logging severity level
43 - Idempotency is not maintained for this attribute for the value 'debugging'
44 since this value is not shown in running-config.
45 type: str
46 choices: &severity_subgroup
47 - alerts
48 - critical
49 - debugging
50 - emergencies
51 - errors
52 - informational
53 - notifications
54 - warnings
55 discriminator: &discriminator
56 description: Establish MD-Buffer association
57 type: str
58 filtered: &filtered
59 description: Enable filtered logging
60 type: bool
61 xml: &xml
62 description: Enable logging in XML to XML logging buffer
63 type: bool
64 buginf:
65 description: Enable buginf logging for debugging
66 type: bool
67 cns_events:
68 description: Set CNS Event logging level
69 type: str
70 choices: *severity_subgroup
71 console:
72 description: Set console logging parameters
73 type: dict
74 suboptions:
75 severity:
76 description: Logging severity level
77 type: str
78 choices:
79 [
80 "alerts",
81 "critical",
82 "debugging",
83 "emergencies",
84 "errors",
85 "informational",
86 "notifications",
87 "warnings",
88 "guaranteed",
89 ]
90 discriminator: *discriminator
91 filtered: *filtered
92 xml: *xml
93 count:
94 description: Count every log message and timestamp last occurrence
95 type: bool
96 delimiter:
97 description: Append delimiter to syslog messages
98 type: dict
99 suboptions:
100 tcp:
101 description: Append delimiter to syslog messages over TCP
102 type: bool
103 discriminator:
104 description: Create or modify a message discriminator
105 type: list
106 elements: str
107 dmvpn:
108 description: DMVPN Configuration
109 type: dict
110 suboptions:
111 rate_limit: &rate_limit
112 description: rate in messages/minute, default is 600 messages/minute (1-10000)
113 type: int
114 esm:
115 description: Set ESM filter restrictions
116 type: dict
117 suboptions:
118 config:
119 description: Permit/Deny configuration changes from ESM filters
120 type: bool
121 exception:
122 description: Limit size of exception flush output (4096-2147483647)
123 type: int
124 facility:
125 description: Facility parameter for syslog messages
126 type: str
127 choices:
128 - auth
129 - cron
130 - daemon
131 - kern
132 - local0
133 - local1
134 - local2
135 - local3
136 - local4
137 - local5
138 - local6
139 - local7
140 - lpr
141 - mail
142 - news
143 - sys10
144 - sys11
145 - sys12
146 - sys13
147 - sys14
148 - sys9
149 - syslog
150 - user
151 - uucp
152 filter:
153 description: Specify logging filter
154 type: list
155 elements: dict
156 suboptions:
157 url:
158 description: Filter Uniform Resource Locator
159 type: str
160 order:
161 description: Order of filter execution
162 type: int
163 args:
164 description: Arguments passed to filter module.
165 type: str
166 history:
167 description: Configure syslog history table
168 type: dict
169 suboptions:
170 size: *size
171 severity: *severity
172 hosts:
173 description: Set syslog server IP address and parameters
174 type: list
175 elements: dict
176 suboptions:
177 discriminator: *discriminator
178 filtered: *filtered
179 sequence_num_session: &sequence_num_session
180 description: Include session sequence number tag in syslog message
181 type: bool
182 session_id: &session_id
183 description: Specify syslog message session ID tagging
184 type: dict
185 suboptions: &session_id_suboptions
186 tag:
187 description: Include hostname in session ID tag
188 type: str
189 choices: ["hostname", "ipv4", "ipv6"]
190 text:
191 description: Include custom string in session ID tag
192 type: str
193 stream: &stream
194 description: This server should only receive messages from a numbered stream
195 type: int
196 transport: &transport
197 description: Specify the transport protocol (default=UDP)
198 type: dict
199 suboptions:
200 tcp:
201 description: Transport Control Protocol
202 type: dict
203 suboptions:
204 audit:
205 description: Set this host for IOS firewall audit logging
206 type: bool
207 discriminator: *discriminator
208 stream: *stream
209 filtered: *filtered
210 port:
211 description: Specify the TCP port number (default=601) (1 - 65535)
212 type: int
213 sequence_num_session: *sequence_num_session
214 session_id: *session_id
215 xml: *xml
216 udp:
217 description: User Datagram Protocol
218 type: dict
219 suboptions:
220 discriminator: *discriminator
221 stream: *stream
222 filtered: *filtered
223 port:
224 description: Specify the UDP port number (default=514) (1 - 65535)
225 type: int
226 sequence_num_session: *sequence_num_session
227 session_id: *session_id
228 xml: *xml
229 vrf:
230 description: Set VRF option
231 type: str
232 xml: *xml
233 ipv6:
234 description: Configure IPv6 syslog server
235 type: str
236 host:
237 description: IP address of the syslog server
238 type: str
239 aliases:
240 - hostname
241 message_counter:
242 description: Configure log message to include certain counter value
243 type: list
244 elements: str
245 choices: ["log", "debug", "syslog"]
246 monitor:
247 description: Set terminal line (monitor) logging parameters
248 type: dict
249 suboptions:
250 severity: *severity
251 discriminator: *discriminator
252 filtered: *filtered
253 xml: *xml
254 logging_on:
255 description: Enable logging to all enabled destinations
256 type: str
257 choices: ["enable", "disable"]
258 origin_id:
259 description: Add origin ID to syslog messages
260 type: dict
261 suboptions:
262 tag:
263 description: Include hostname in session ID tag
264 type: str
265 choices: ["hostname", "ip", "ipv6"]
266 text:
267 description: Include custom string in session ID tag
268 type: str
269 persistent:
270 description: Set persistent logging parameters
271 type: dict
272 suboptions:
273 batch:
274 description: Set batch size for writing to persistent storage (4096-2142715904)
275 type: int
276 filesize:
277 description: Set size of individual log files (4096-2142715904)
278 type: int
279 immediate:
280 description: Write log entry to storage immediately (no buffering).
281 type: bool
282 notify:
283 description: Notify when show logging [persistent] is activated.
284 type: bool
285 protected:
286 description: Eliminates manipulation on logging-persistent files.
287 type: bool
288 size:
289 description: Set disk space for writing log messages (4096-2142715904)
290 type: int
291 threshold:
292 description: Set threshold for logging persistent
293 type: int
294 url:
295 description: URL to store logging messages
296 type: str
297 policy_firewall:
298 description: Firewall configuration
299 type: dict
300 suboptions:
301 rate_limit:
302 description: (0-3600) value in seconds, default is 30 Sec.
303 type: int
304 queue_limit:
305 description: Set logger message queue size
306 type: dict
307 suboptions:
308 size:
309 description: (100-2147483647) set new queue size
310 type: int
311 esm:
312 description: (100-2147483647) set new queue size
313 type: int
314 trap:
315 description: (100-2147483647) set new queue size
316 type: int
317 rate_limit:
318 description: Set messages per second limit
319 type: dict
320 suboptions:
321 size: &rate_limit_size
322 description: (1-10000) message per second
323 type: int
324 required: true
325 all:
326 description: (1-10000) message per second
327 type: bool
328 console:
329 description: (1-10000) message per second
330 type: bool
331 except_severity:
332 description: Messages of this severity or higher
333 type: str
334 choices: *severity_subgroup
335 reload:
336 description: Set reload logging level
337 type: dict
338 suboptions:
339 severity: *severity
340 message_limit:
341 description: Number of messages (1-4294967295)
342 type: int
343 server_arp:
344 description: Enable sending ARP requests for syslog servers when first configured
345 type: bool
346 snmp_trap:
347 description: Set syslog level for sending snmp trap
348 type: list
349 elements: str
350 choices: *severity_subgroup
351 source_interface:
352 description: Specify interface for source address in logging transactions
353 type: list
354 elements: dict
355 suboptions:
356 interface:
357 description: Interface name with number
358 type: str
359 vrf:
360 description: VPN Routing/Forwarding instance name
361 type: str
362 trap:
363 description: Set syslog server logging level
364 type: str
365 choices: *severity_subgroup
366 userinfo:
367 description: Enable logging of user info on privileged mode enabling
368 type: bool
369 running_config:
370 description:
371 - This option is used only with state I(parsed).
372 - The value of this option should be the output received from the IOS device by
373 executing the command B(show running-config | include logging).
374 - The state I(parsed) reads the configuration from C(running_config) option and
375 transforms it into Ansible structured data as per the resource module's argspec
376 and the value is then returned in the I(parsed) key within the result.
377 type: str
378 state:
379 choices:
380 - merged
381 - replaced
382 - overridden
383 - deleted
384 - gathered
385 - parsed
386 - rendered
387 default: merged
388 description:
389 - The state the configuration should be left in
390 - With state I(replaced), for the listed logging configurations,
391 that are in running-config and can have multiple set of commands
392 but not in the task are negated.
393 - With state I(overridden), all configurations that are in running-config but
394 not in the task are negated.
395 - Please refer to examples for more details.
396 type: str
397 """
398
399 EXAMPLES = """
400 # Using state: merged
401
402 # Before state:
403 # -------------
404
405 # router-ios#show running-config | section logging
406 # no logging exception
407 # no logging buffered
408 # no logging reload
409 # no logging rate-limit
410 # no logging console
411 # no logging monitor
412 # no logging cns-events
413 # no logging trap
414
415 - name: Apply the provided configuration
416 cisco.ios.ios_logging_global:
417 config:
418 buffered:
419 severity: notifications
420 size: 5099
421 xml: true
422 console:
423 severity: critical
424 xml: true
425 facility: local5
426 hosts:
427 - hostname: 172.16.1.12
428 - hostname: 172.16.1.11
429 xml: true
430 - hostname: 172.16.1.10
431 filtered: true
432 stream: 10
433 - hostname: 172.16.1.13
434 transport:
435 tcp:
436 port: 514
437 monitor:
438 severity: warnings
439 message_counter: log
440 snmp_trap:
441 - errors
442 trap: errors
443 userinfo: true
444 policy_firewall:
445 rate_limit: 10
446 logging_on: enable
447 exception: 4099
448 dmvpn:
449 rate_limit: 10
450 cns_events: warnings
451 state: merged
452
453 # Commands Fired:
454 # ---------------
455
456 # "commands": [
457 # "logging buffered xml 5099 notifications",
458 # "logging cns-events warnings",
459 # "logging console xml critical",
460 # "logging dmvpn rate-limit 10",
461 # "logging exception 4099",
462 # "logging facility local5",
463 # "logging monitor warnings",
464 # "logging on",
465 # "logging policy-firewall rate-limit 10",
466 # "logging trap errors",
467 # "logging userinfo",
468 # "logging host 172.16.1.12",
469 # "logging host 172.16.1.10 filtered stream 10",
470 # "logging host 172.16.1.13 transport tcp port 514",
471 # "logging message-counter log",
472 # "logging snmp-trap errors",
473 # "logging host 172.16.1.11 xml"
474 # ],
475
476 # After state:
477 # ------------
478
479 # router-ios#show running-config | section logging
480 # logging exception 4099
481 # logging message-counter log
482 # logging userinfo
483 # logging buffered xml 5099 notifications
484 # no logging reload
485 # no logging rate-limit
486 # logging console xml critical
487 # logging monitor warnings
488 # logging cns-events warnings
489 # logging policy-firewall rate-limit 10
490 # logging dmvpn rate-limit 10
491 # logging trap errors
492 # logging facility local5
493 # logging snmp-trap errors
494 # logging snmp-trap warnings
495 # logging host 172.16.1.13 transport tcp port 514
496 # logging host 172.16.1.11 xml
497 # logging host 172.16.1.12
498 # logging host 172.16.1.10 filtered stream 10
499
500 # Using state: deleted
501
502 # Before state:
503 # -------------
504
505 # router-ios#show running-config | section logging
506 # logging exception 4099
507 # logging message-counter log
508 # logging userinfo
509 # logging buffered xml 5099 notifications
510 # no logging reload
511 # no logging rate-limit
512 # logging console xml critical
513 # logging monitor warnings
514 # logging cns-events warnings
515 # logging policy-firewall rate-limit 10
516 # logging dmvpn rate-limit 10
517 # logging trap errors
518 # logging facility local5
519 # logging snmp-trap errors
520 # logging host 172.16.1.13 transport tcp port 514
521 # logging host 172.16.1.11 xml
522 # logging host 172.16.1.12
523 # logging host 172.16.1.10 filtered stream 10
524
525 - name: Remove all existing configuration
526 cisco.ios.ios_logging_global:
527 state: deleted
528
529 # Commands Fired:
530 # ---------------
531
532 # "commands": [
533 # "no logging message-counter log",
534 # "no logging snmp-trap errors",
535 # "no logging host 172.16.1.13",
536 # "no logging host 172.16.1.11",
537 # "no logging host 172.16.1.12",
538 # "no logging host 172.16.1.10",
539 # "no logging exception 4099",
540 # "no logging userinfo",
541 # "no logging buffered xml 5099 notifications",
542 # "no logging console xml critical",
543 # "no logging monitor warnings",
544 # "no logging cns-events warnings",
545 # "no logging policy-firewall rate-limit 10",
546 # "no logging dmvpn rate-limit 10",
547 # "no logging trap errors",
548 # "no logging facility local5"
549 # ],
550
551 # After state:
552 # ------------
553
554 # router-ios#show running-config | section logging
555 # no logging exception
556 # no logging buffered
557 # no logging reload
558 # no logging rate-limit
559 # no logging console
560 # no logging monitor
561 # no logging cns-events
562 # no logging trap
563
564 # Using state: overridden
565
566 # Before state:
567 # -------------
568
569 # router-ios#show running-config | section logging
570 # logging exception 4099
571 # logging message-counter log
572 # logging userinfo
573 # logging buffered 6000 critical
574 # no logging reload
575 # no logging rate-limit
576 # logging console xml critical
577 # logging monitor warnings
578 # logging cns-events warnings
579 # logging policy-firewall rate-limit 10
580 # logging dmvpn rate-limit 10
581 # logging trap errors
582 # logging facility local6
583 # logging host 172.16.1.13 transport tcp port 514
584 # logging host 172.16.1.12
585 # logging host 172.16.1.10 filtered stream 10
586 # logging host 172.16.1.25 filtered
587
588 - name: Override commands with provided configuration
589 cisco.ios.ios_logging_global:
590 config:
591 hosts:
592 - hostname: 172.16.1.27
593 filtered: true
594 state: overridden
595
596 # Commands Fired:
597 # ---------------
598 # "commands": [
599 # "no logging message-counter log",
600 # "no logging host 172.16.1.12",
601 # "no logging host 172.16.1.10",
602 # "no logging host 172.16.1.13",
603 # "no logging exception 4099",
604 # "no logging userinfo",
605 # "no logging console xml critical",
606 # "no logging monitor warnings",
607 # "no logging cns-events warnings",
608 # "no logging policy-firewall rate-limit 10",
609 # "no logging dmvpn rate-limit 10",
610 # "no logging trap errors",
611 # "no logging buffered 6000 critical",
612 # "no logging facility local6",
613 # "logging host 172.16.1.27 filtered",
614 # ],
615
616 # After state:
617 # ------------
618
619 # router-ios#show running-config | section logging
620 # no logging exception
621 # no logging buffered
622 # no logging reload
623 # no logging rate-limit
624 # no logging console
625 # no logging monitor
626 # no logging cns-events
627 # no logging trap
628 # logging host 172.16.1.27 filtered
629
630 # Using state: replaced
631
632 # Before state:
633 # -------------
634
635 # router-ios#show running-config | section logging
636 # logging exception 4099
637 # logging message-counter log
638 # logging userinfo
639 # logging buffered xml 5099 notifications
640 # no logging reload
641 # no logging rate-limit
642 # logging console xml critical
643 # logging monitor warnings
644 # logging cns-events warnings
645 # logging policy-firewall rate-limit 10
646 # logging dmvpn rate-limit 10
647 # logging trap errors
648 # logging facility local5
649 # logging snmp-trap errors
650 # logging host 172.16.1.13 transport tcp port 514
651 # logging host 172.16.1.11 xml
652 # logging host 172.16.1.12
653 # logging host 172.16.1.10 filtered stream 10
654
655 - name: Replace commands with provided configuration
656 cisco.ios.ios_logging_global:
657 config:
658 buffered:
659 severity: alerts
660 size: 6025
661 facility: local6
662 hosts:
663 - hostname: 172.16.1.19
664 - hostname: 172.16.1.10
665 filtered: true
666 stream: 15
667 state: replaced
668
669 # Commands Fired:
670 # ---------------
671
672 # "commands": [
673 # "no logging host 172.16.1.13",
674 # "no logging host 172.16.1.11",
675 # "no logging host 172.16.1.12",
676 # "no logging host 172.16.1.10",
677 # "logging host 172.16.1.19",
678 # "logging host 172.16.1.10 filtered stream 15",
679 # "logging buffered 6025 alerts",
680 # "logging facility local6"
681 # ],
682
683 # After state:
684 # ------------
685
686 # router-ios#show running-config | section logging
687 # logging exception 4099
688 # logging message-counter log
689 # logging userinfo
690 # logging buffered 6025 alerts
691 # no logging reload
692 # no logging rate-limit
693 # logging console xml critical
694 # logging monitor warnings
695 # logging cns-events warnings
696 # logging policy-firewall rate-limit 10
697 # logging dmvpn rate-limit 10
698 # logging trap errors
699 # logging facility local6
700 # logging snmp-trap errors
701 # logging host 172.16.1.19
702
703 # Using state: gathered
704
705 # Before state:
706 # -------------
707
708 # router-ios#show running-config | section logging
709 # logging exception 4099
710 # logging message-counter log
711 # logging userinfo
712 # logging buffered xml 5099 notifications
713 # no logging reload
714 # no logging rate-limit
715 # logging console xml critical
716 # logging monitor warnings
717 # logging cns-events warnings
718 # logging policy-firewall rate-limit 10
719 # logging dmvpn rate-limit 10
720 # logging trap errors
721 # logging facility local5
722 # logging snmp-trap errors
723 # logging host 172.16.1.13 transport tcp port 514
724 # logging host 172.16.1.11 xml
725 # logging host 172.16.1.12
726 # logging host 172.16.1.10 filtered stream 10
727 # logging host 172.16.1.25 filtered
728
729 - name: Gather listed logging config
730 cisco.ios.ios_logging_global:
731 state: gathered
732
733 # Module Execution Result:
734 # ------------------------
735
736 # "gathered": {
737 # "buffered": {
738 # "severity": "notifications",
739 # "size": 5099,
740 # "xml": true
741 # },
742 # "cns_events": "warnings",
743 # "console": {
744 # "severity": "critical",
745 # "xml": true
746 # },
747 # "dmvpn": {
748 # "rate_limit": 10
749 # },
750 # "exception": 4099,
751 # "facility": "local5",
752 # "hosts": [
753 # {
754 # "hostname": "172.16.1.11",
755 # "xml": true
756 # },
757 # {
758 # "hostname": "172.16.1.12"
759 # },
760 # {
761 # "filtered": true,
762 # "hostname": "172.16.1.10",
763 # "stream": 10
764 # },
765 # {
766 # "hostname": "172.16.1.13",
767 # "transport": {
768 # "tcp": {
769 # "port": 514
770 # }
771 # }
772 # },
773 # {
774 # "filtered": true,
775 # "hostname": "172.16.1.25"
776 # }
777 # ],
778 # "message_counter": [
779 # "log"
780 # ],
781 # "monitor": {
782 # "severity": "warnings"
783 # },
784 # "policy_firewall": {
785 # "rate_limit": 10
786 # },
787 # "snmp_trap": [
788 # "errors"
789 # ],
790 # "trap": "errors",
791 # "userinfo": true
792 # },
793
794 # After state:
795 # -------------
796
797 # router-ios#show running-config | section logging
798 # logging exception 4099
799 # logging message-counter log
800 # logging userinfo
801 # logging buffered xml 5099 notifications
802 # no logging reload
803 # no logging rate-limit
804 # logging console xml critical
805 # logging monitor warnings
806 # logging cns-events warnings
807 # logging policy-firewall rate-limit 10
808 # logging dmvpn rate-limit 10
809 # logging trap errors
810 # logging facility local5
811 # logging snmp-trap errors
812 # logging host 172.16.1.13 transport tcp port 514
813 # logging host 172.16.1.11 xml
814 # logging host 172.16.1.12
815 # logging host 172.16.1.10 filtered stream 10
816 # logging host 172.16.1.25 filtered
817
818 # Using state: rendered
819
820 - name: Render the commands for provided configuration
821 cisco.ios.ios_logging_global:
822 config:
823 buffered:
824 severity: notifications
825 size: 5099
826 xml: true
827 console:
828 severity: critical
829 xml: true
830 facility: local5
831 hosts:
832 - hostname: 172.16.1.12
833 - hostname: 172.16.1.11
834 xml: true
835 - hostname: 172.16.1.10
836 filtered: true
837 stream: 10
838 - hostname: 172.16.1.13
839 transport:
840 tcp:
841 port: 514
842 monitor:
843 severity: warnings
844 message_counter: log
845 snmp_trap: errors
846 trap: errors
847 userinfo: true
848 policy_firewall:
849 rate_limit: 10
850 logging_on: enable
851 exception: 10
852 dmvpn:
853 rate_limit: 10
854 cns_events: warnings
855 state: rendered
856
857 # Module Execution Result:
858 # ------------------------
859
860 # "rendered": [
861 # "logging host 172.16.1.12",
862 # "logging host 172.16.1.11 xml",
863 # "logging host 172.16.1.10 filtered stream 10",
864 # "logging host 172.16.1.13 transport tcp port 514",
865 # "logging message-counter log",
866 # "logging snmp-trap errors",
867 # "logging buffered xml 5099 notifications",
868 # "logging console xml critical",
869 # "logging facility local5",
870 # "logging monitor warnings",
871 # "logging trap errors",
872 # "logging userinfo",
873 # "logging policy-firewall rate-limit 10",
874 # "logging on",
875 # "logging exception 10",
876 # "logging dmvpn rate-limit 10",
877 # "logging cns-events warnings"
878 # ]
879
880 # Using state: parsed
881
882 # File: parsed.cfg
883 # ----------------
884
885 # logging on
886 # logging count
887 # logging userinfo
888 # logging trap errors
889 # logging reload alerts
890 # logging host 172.16.1.1
891 # logging exception 4099
892 # logging history alerts
893 # logging facility local5
894 # logging snmp-trap errors
895 # logging monitor warnings
896 # logging origin-id hostname
897 # logging host 172.16.1.11 xml
898 # logging cns-events warnings
899 # logging dmvpn rate-limit 10
900 # logging message-counter log
901 # logging console xml critical
902 # logging message-counter debug
903 # logging persistent batch 4444
904 # logging host 172.16.1.25 filtered
905 # logging source-interface GBit1/0
906 # logging source-interface CTunnel2
907 # logging policy-firewall rate-limit 10
908 # logging buffered xml 5099 notifications
909 # logging rate-limit all 2 except warnings
910 # logging host 172.16.1.10 filtered stream 10
911 # logging host 172.16.1.13 transport tcp port 514
912 # logging discriminator msglog01 severity includes 5
913 # logging filter tftp://172.16.2.18/ESM/elate.tcl args TESTInst2
914 # logging filter tftp://172.16.2.14/ESM/escalate.tcl args TESTInst
915
916 - name: Parse the provided configuration with the existing running configuration
917 cisco.ios.ios_logging_global:
918 running_config: "{{ lookup('file', 'parsed.cfg') }}"
919 state: parsed
920
921 # Module Execution Result:
922 # ------------------------
923
924 # "parsed": {
925 # "buffered": {
926 # "severity": "notifications",
927 # "size": 5099,
928 # "xml": true
929 # },
930 # "cns_events": "warnings",
931 # "console": {
932 # "severity": "critical",
933 # "xml": true
934 # },
935 # "count": true,
936 # "discriminator": [
937 # "msglog01 severity includes 5"
938 # ],
939 # "dmvpn": {
940 # "rate_limit": 10
941 # },
942 # "exception": 4099,
943 # "facility": "local5",
944 # "filter": [
945 # {
946 # "args": "TESTInst2",
947 # "url": "tftp://172.16.2.18/ESM/elate.tcl"
948 # },
949 # {
950 # "args": "TESTInst",
951 # "url": "tftp://172.16.2.14/ESM/escalate.tcl"
952 # }
953 # ],
954 # "history": {
955 # "severity": "alerts"
956 # },
957 # "hosts": [
958 # {
959 # "hostname": "172.16.1.1"
960 # },
961 # {
962 # "hostname": "172.16.1.11",
963 # "xml": true
964 # },
965 # {
966 # "filtered": true,
967 # "hostname": "172.16.1.25"
968 # },
969 # {
970 # "filtered": true,
971 # "hostname": "172.16.1.10",
972 # "stream": 10
973 # },
974 # {
975 # "hostname": "172.16.1.13",
976 # "transport": {
977 # "tcp": {
978 # "port": 514
979 # }
980 # }
981 # }
982 # ],
983 # "logging_on": "enable",
984 # "message_counter": [
985 # "log",
986 # "debug"
987 # ],
988 # "monitor": {
989 # "severity": "warnings"
990 # },
991 # "origin_id": {
992 # "tag": "hostname"
993 # },
994 # "persistent": {
995 # "batch": 4444
996 # },
997 # "policy_firewall": {
998 # "rate_limit": 10
999 # },
1000 # "rate_limit": {
1001 # "all": true,
1002 # "except_severity": "warnings",
1003 # "size": 2
1004 # },
1005 # "reload": {
1006 # "severity": "alerts"
1007 # },
1008 # "snmp_trap": [
1009 # "errors"
1010 # ],
1011 # "source_interface": [
1012 # {
1013 # "interface": "GBit1/0"
1014 # },
1015 # {
1016 # "interface": "CTunnel2"
1017 # }
1018 # ],
1019 # "trap": "errors",
1020 # "userinfo": true
1021 # }
1022 """
1023
1024 RETURN = """
1025 before:
1026 description: The configuration prior to the model invocation.
1027 returned: always
1028 sample: >
1029 The configuration returned will always be in the same format
1030 of the parameters above.
1031 type: dict
1032 after:
1033 description: The resulting configuration model invocation.
1034 returned: when changed
1035 sample: >
1036 The configuration returned will always be in the same format
1037 of the parameters above.
1038 type: dict
1039 commands:
1040 description: The set of commands pushed to the remote device.
1041 returned: always
1042 type: list
1043 sample:
1044 - "logging on"
1045 - "logging userinfo"
1046 - "logging trap errors"
1047 - "logging host 172.16.1.12"
1048 - "logging console xml critical"
1049 - "logging message-counter log"
1050 - "logging policy-firewall rate-limit 10"
1051 """
1052
1053 from ansible.module_utils.basic import AnsibleModule
1054
1055 from ansible_collections.cisco.ios.plugins.module_utils.network.ios.argspec.logging_global.logging_global import (
1056 Logging_globalArgs,
1057 )
1058 from ansible_collections.cisco.ios.plugins.module_utils.network.ios.config.logging_global.logging_global import (
1059 Logging_global,
1060 )
1061
1062
1063 def main():
1064 """
1065 Main entry point for module execution
1066
1067 :returns: the result form module invocation
1068 """
1069 module = AnsibleModule(
1070 argument_spec=Logging_globalArgs.argument_spec,
1071 mutually_exclusive=[["config", "running_config"]],
1072 required_if=[
1073 ["state", "merged", ["config"]],
1074 ["state", "replaced", ["config"]],
1075 ["state", "overridden", ["config"]],
1076 ["state", "rendered", ["config"]],
1077 ["state", "parsed", ["running_config"]],
1078 ],
1079 supports_check_mode=True,
1080 )
1081
1082 result = Logging_global(module).execute_module()
1083 module.exit_json(**result)
1084
1085
1086 if __name__ == "__main__":
1087 main()