Debian Codegraph @

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

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # Copyright 2022 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_snmp_server
9 """
10
11 from __future__ import absolute_import, division, print_function
12
13
14 __metaclass__ = type
15
16 DOCUMENTATION = """
17 author:
18 - Sagar Paul (@KB-perByte)
19 description:
20 - This module provides declarative management of SNMP server on Cisco IOS devices.
21 module: ios_snmp_server
22 notes:
23 - Tested against Cisco IOSXE Version 17.3 on CML.
24 - This module works with connection C(network_cli).
25 options:
26 config:
27 description: A dictionary of SNMP server configuration
28 suboptions:
29 accounting:
30 description: SNMP Accounting parameters
31 suboptions:
32 command:
33 description: For SNMP set commands
34 type: str
35 type: dict
36 cache:
37 description: Enable SNMP cache and MIB expiry interval
38 type: int
39 chassis_id:
40 description: String to uniquely identify this chassis (Hexadecimal)
41 type: str
42 communities:
43 description: Community name configuration.
44 elements: dict
45 suboptions:
46 acl_v4:
47 description: standard access-list name
48 type: str
49 acl_v6:
50 description: IPv6 access list name
51 type: str
52 name:
53 description: Community name (default RO)
54 type: str
55 ro:
56 description: Only reads are permitted
57 type: bool
58 rw:
59 description: Read-write access
60 type: bool
61 view:
62 description: MIB view name
63 type: str
64 type: list
65 contact:
66 description: Text for mib object sysContact
67 type: str
68 context:
69 description: Create/Delete a context apart from default
70 elements: str
71 type: list
72 drop:
73 description: Silently drop SNMP packets
74 suboptions:
75 unknown_user:
76 description: Silently drop unknown v3 user packets
77 type: bool
78 vrf_traffic:
79 description: Silently drop SNMP packets that come on VRF interfaces
80 type: bool
81 type: dict
82 engine_id:
83 description: Configure a local or remote SNMPv3 engineID
84 elements: dict
85 suboptions:
86 id:
87 description: engine ID octet string
88 type: str
89 local:
90 description: Local SNMP agent
91 type: bool
92 remote:
93 description: Remote SNMP agent
94 suboptions:
95 host:
96 description: Hostname or IP address of remote SNMP notification host
97 type: str
98 udp_port:
99 description: The remote SNMP notification host's UDP port number.
100 type: int
101 vrf:
102 description: The remote notification host's VPN routing instance
103 type: str
104 type: dict
105 type: list
106 file_transfer:
107 description: File transfer related commands
108 suboptions:
109 access_group:
110 description: Access control for file transfers
111 type: str
112 protocol:
113 description: Access control protocol for file transfers
114 type: list
115 elements: str
116 type: dict
117 groups:
118 description: Define a User Security Model group
119 elements: dict
120 suboptions:
121 context:
122 description: Specify a context to associate with the group
123 type: str
124 match:
125 choices:
126 - exact
127 - prefix
128 description: Specify a context name match criteria
129 type: str
130 version_option:
131 choices:
132 - auth
133 - noauth
134 - priv
135 description: community name to the host.
136 type: str
137 group:
138 description: SNMP group for the user
139 type: str
140 notify:
141 description: View to restrict notifications
142 type: str
143 read:
144 description: View to restrict read access
145 type: str
146 version:
147 choices:
148 - v1
149 - v3
150 - v2c
151 description: snmp security group version
152 type: str
153 write:
154 description: View to restrict write access
155 type: str
156 acl_v4:
157 description: specify an access-list associated with this group
158 type: str
159 acl_v6:
160 description: specify an access-list associated with this group
161 type: str
162 type: list
163 hosts:
164 description: Specify hosts to receive SNMP notifications
165 elements: dict
166 suboptions:
167 host:
168 description: Hostname or IP address of SNMP notification host.
169 type: str
170 informs:
171 description: Use SNMP inform messages.
172 type: bool
173 community_string:
174 description: SNMPv1/v2c community string or SNMPv3 user name
175 type: str
176 traps:
177 description: Use SNMP trap messages
178 type: list
179 elements: str
180 version:
181 choices:
182 - '1'
183 - 2c
184 - '3'
185 description: Notification message SNMP version.
186 type: str
187 version_option:
188 choices:
189 - auth
190 - noauth
191 - priv
192 description: community name to the host.
193 type: str
194 vrf:
195 description: Specify the VRF in which the host is configured
196 type: str
197 type: list
198 if_index:
199 description: Enable ifindex persistence
200 type: bool
201 inform:
202 description: Configure SNMP Informs options
203 suboptions:
204 pending:
205 description: Set number of unacked informs to hold
206 type: int
207 retries:
208 description: Set retry count for informs
209 type: int
210 timeout:
211 description: Set timeout for informs
212 type: int
213 type: dict
214 ip:
215 description: IP ToS configuration for SNMP traffic
216 suboptions:
217 dscp:
218 description: IP DSCP value for SNMP traffic
219 type: int
220 precedence:
221 description: IP Precedence value for SNMP traffic
222 type: int
223 type: dict
224 location:
225 description: Text for mib object sysLocation
226 type: str
227 manager:
228 description: Modify SNMP manager parameters
229 type: int
230 packet_size:
231 description: Largest SNMP packet size
232 type: int
233 password_policy:
234 description: SNMP v3 users password policy
235 elements: dict
236 suboptions:
237 change:
238 description: Number of Character changes b/w old and new password
239 type: int
240 digits:
241 description: Number of digits
242 type: int
243 lower_case:
244 description: Number of lower-case characters
245 type: int
246 max_len:
247 description: Maximum password length
248 type: int
249 min_len:
250 description: Minimum password length
251 type: int
252 policy_name:
253 description: Name of the policy
254 type: str
255 special_char:
256 description: Number of special case character
257 type: int
258 upper_case:
259 description: Number of upper-case characters
260 type: int
261 username:
262 description: Name of the user
263 type: str
264 type: list
265 queue_length:
266 description: Message queue length for each TRAP host
267 type: int
268 source_interface:
269 description: Source interface to be used for sending out SNMP notifications.
270 type: str
271 system_shutdown:
272 description: Enable use of the SNMP reload command
273 type: bool
274 trap_source:
275 description: Assign an interface for the source address of all traps
276 type: str
277 trap_timeout:
278 description: Set timeout for TRAP message retransmissions
279 type: int
280 traps:
281 description: Enable SNMP Traps
282 suboptions:
283 aaa_server:
284 description: Enable SNMP AAA Server traps
285 type: bool
286 auth_framework:
287 description: Enable SNMP CISCO-AUTH-FRAMEWORK-MIB traps
288 suboptions:
289 sec_violation:
290 description: Mode sec_violation
291 type: bool
292 enable:
293 description: Enable/disable auth framework
294 type: bool
295 type: dict
296 bfd:
297 description: Allow SNMP BFD traps
298 suboptions:
299 enable:
300 description: Enable/disable bfd
301 type: bool
302 session_down:
303 description: Enable BFD session down traps
304 type: bool
305 session_up:
306 description: Enable BFD session up traps
307 type: bool
308 type: dict
309 bgp:
310 description: Allow bgp traps
311 suboptions:
312 cbgp2:
313 description: Enable BGP MIBv2 traps
314 type: bool
315 enable:
316 description: Enable/disable bgp traps
317 type: bool
318 state_changes:
319 description: Traps for FSM state changes
320 suboptions:
321 all:
322 description: CISCO specific trap for all fsm state changes
323 type: bool
324 backward_trans:
325 description: CISCO specific trap for backward transition
326 type: bool
327 limited:
328 description: Trap for standard backward transition and established
329 type: bool
330 enable:
331 description: Enable/disable bgp state_changes traps
332 type: bool
333 type: dict
334 threshold:
335 description: Mode threshold
336 suboptions:
337 prefix:
338 description: Enable/disable bgp threshold traps
339 type: bool
340 type: dict
341 type: dict
342 bridge:
343 description: Allow bridge related traps
344 suboptions:
345 newroot:
346 description: Enable SNMP STP Bridge MIB newroot traps
347 type: bool
348 enable:
349 description: Enable/disable bridge traps
350 type: bool
351 topologychange:
352 description: Enable SNMP STP Bridge MIB topologychange traps
353 type: bool
354 type: dict
355 bulkstat:
356 description: Allow Data-Collection-MIB Collection notifications
357 suboptions:
358 enable:
359 description: Enable Data-Collection-MIB Collection and Transfert notifications
360 type: bool
361 collection:
362 description: Enable Data-Collection-MIB Collection notifications
363 type: bool
364 transfer:
365 description: Enable Data-Collection-MIB Transfer notifications
366 type: bool
367 type: dict
368 call_home:
369 description: SNMP CISCO-CALLHOME-MIB traps
370 suboptions:
371 enable:
372 description: Enable SNMP CISCO-CALLHOME-MIB traps
373 type: bool
374 message_send_fail:
375 description: Enable SNMP ccmSmtpMsgSendFailNotif notification
376 type: bool
377 server_fail:
378 description: Enable SNMP ccmSmtpServerFailNotif notification
379 type: bool
380 type: dict
381 casa:
382 description: Enable SNMP config casa traps
383 type: bool
384 cef:
385 description: Allow cef related traps
386 suboptions:
387 inconsistency:
388 description: Enable SNMP CEF Inconsistency traps
389 type: bool
390 peer_fib_state_change:
391 description: Enable SNMP CEF Peer FIB State change traps
392 type: bool
393 peer_state_change:
394 description: Enable SNMP CEF Peer state change traps
395 type: bool
396 resource_failure:
397 description: Enable SNMP CEF Resource Failure traps
398 type: bool
399 enable:
400 description: Enable/disable cef traps
401 type: bool
402 type: dict
403 cnpd:
404 description: Enable SNMP cnpd traps
405 type: bool
406 config:
407 description: Enable SNMP config traps
408 type: bool
409 config_copy:
410 description: Enable SNMP config copy traps
411 type: bool
412 config_ctid:
413 description: Enable SNMP config ctid traps
414 type: bool
415 cpu:
416 description: Allow CPU related traps
417 suboptions:
418 enable:
419 description: Enable/disable cpu traps
420 type: bool
421 threshold:
422 description: Mode threshold
423 type: bool
424 type: dict
425 dhcp:
426 description: Enable SNMP dhcp traps
427 type: bool
428 dlsw:
429 description: Allow dlsw related traps
430 suboptions:
431 circuit:
432 description: Enable SNMP dlsw circuit traps
433 type: bool
434 enable:
435 description: Enable/disable cef traps
436 type: bool
437 tconn:
438 description: Enable SNMP dlsw peer transport connection traps
439 type: bool
440 type: dict
441 eigrp:
442 description: Enable SNMP eigrp traps
443 type: bool
444 entity:
445 description: Enable SNMP entity traps
446 type: bool
447 entity_diag:
448 description: Allow SNMP CISCO-ENTITY-DIAG-MIB traps
449 suboptions:
450 boot_up_fail:
451 description: Enable SNMP ceDiagBootUpFailedNotif traps
452 type: bool
453 enable:
454 description: Enable SNMP CISCO-ENTITY-DIAG-MIB traps
455 type: bool
456 hm_test_recover:
457 description: Enable SNMP ceDiagHMTestRecoverNotif traps
458 type: bool
459 hm_thresh_reached:
460 description: Enable SNMP ceDiagHMThresholdReachedNotif traps
461 type: bool
462 scheduled_test_fail:
463 description: Enable SNMP ceDiagScheduledTestFailedNotif traps
464 type: bool
465 type: dict
466 entity_perf:
467 description: Allow SNMP CISCO-ENTITY-PERFORMANCE-MIB traps
468 suboptions:
469 enable:
470 description: Enable SNMP CISCO-ENTITY-PERFORMANCE-MIB traps
471 type: bool
472 throughput_notif:
473 description: Enable ENTITY PERFORMANCE MIB throughput traps
474 type: bool
475 type: dict
476 entity_state:
477 description: Enable SNMP ENTITY-STATE-MIB traps
478 type: bool
479 energywise:
480 description: Enable SNMP energywise traps
481 type: bool
482 envmon:
483 description: Enable SNMP environmental monitor traps
484 suboptions:
485 enable:
486 description: Enable/disable envmon traps
487 type: bool
488 fan:
489 description:
490 - Enable SNMP envmon fan traps
491 - This option is DEPRECATED and is replaced with fan_enable which accepts bool as input
492 - This attribute will be removed after 2024-09-01
493 suboptions:
494 enable:
495 description: Enable/disable fan traps
496 type: bool
497 shutdown:
498 description: Enable SNMP environmental monitor shutdown traps
499 type: bool
500 status:
501 description: Enable SNMP environmental status change traps
502 type: bool
503 supply:
504 description: Enable SNMP environmental monitor supply traps
505 type: bool
506 temperature:
507 description: Enable SNMP environmental monitor temperature traps
508 type: bool
509 type: dict
510 fan_enable:
511 description: Enable SNMP envmon fan traps
512 type: bool
513 shutdown:
514 description: Enable SNMP environmental monitor shutdown traps
515 type: bool
516 status:
517 description: Enable SNMP environmental status change traps
518 type: bool
519 supply:
520 description: Enable SNMP environmental monitor supply traps
521 type: bool
522 temperature:
523 description: Enable SNMP environmental monitor temperature traps
524 type: bool
525 type: dict
526 errdisable:
527 description: Enable SNMP errdisable notifications
528 type: bool
529 ethernet:
530 description: Allow ethernet traps
531 suboptions:
532 cfm:
533 description: Enable SNMP Ethernet CFM traps
534 suboptions:
535 alarm:
536 description: Enable SNMP Ethernet CFM fault alarm trap
537 type: bool
538 cc:
539 description: Enable SNMP Ethernet CC trap
540 type: dict
541 suboptions:
542 config:
543 description: Enable SNMP Ethernet CFM configuration error traps
544 type: bool
545 cross_connect:
546 description: Enable SNMP Ethernet CFM cross-connect traps
547 type: bool
548 loop:
549 description: Enable SNMP Ethernet CFM loop traps
550 type: bool
551 mep_down:
552 description: Enable SNMP Ethernet CFM CC Down traps
553 type: bool
554 mep_up:
555 description: Enable SNMP Ethernet CFM CC Up traps
556 type: bool
557 crosscheck:
558 description: Enable SNMP Ethernet CC crosscheck trap
559 type: dict
560 suboptions:
561 mep_missing:
562 description: Enable SNMP Ethernet CC crosscheck missing trap
563 type: bool
564 mep_unknown:
565 description: Enable SNMP Ethernet CC crosscheck unknown traps
566 type: bool
567 service_up:
568 description: Enable SNMP Ethernet CC crosscheck service traps
569 type: bool
570 type: dict
571 evc:
572 description: Enable SNMP Ethernet EVC traps
573 suboptions:
574 create:
575 description: Enable SNMP Ethernet EVC create traps
576 type: bool
577 delete:
578 description: Enable SNMP Ethernet EVC delete traps
579 type: bool
580 status:
581 description: Enable SNMP Ethernet EVC status traps
582 type: bool
583 type: dict
584 type: dict
585 ether_oam:
586 description: Enable SNMP ethernet oam traps
587 type: bool
588 event_manager:
589 description: Enable SNMP event-manager traps
590 type: bool
591 flash:
592 description: SNMP FLASH notifications
593 suboptions:
594 enable:
595 description: Enable SNMP FLASH notifications
596 type: bool
597 insertion:
598 description: Enable SNMP Flash Insertion notifications
599 type: bool
600 lowspace:
601 description: Enable SNMP Flash Low Space notifications
602 type: bool
603 removal:
604 description: Enable SNMP Flash Removal notifications
605 type: bool
606 type: dict
607 flex_links:
608 description: SNMP FLEX Links traps
609 suboptions:
610 enable:
611 description: Enable SNMP FLEX Links traps
612 type: bool
613 status:
614 description: Enable SNMP FLEX Links status change traps
615 type: bool
616 type: dict
617 firewall:
618 description: Enable SNMP firewall traps
619 suboptions:
620 enable:
621 description: Enable/disable firewall traps
622 type: bool
623 serverstatus:
624 description: Enable firewall server status change trap
625 type: bool
626 type: dict
627 flowmon:
628 description: Enable SNMP flowmon traps
629 type: bool
630 frame_relay:
631 description: Allow frame-relay traps
632 suboptions:
633 enable:
634 description: Enable/disable frame-relay traps
635 type: bool
636 subif:
637 description: Enable SNMP frame-relay subinterface traps
638 suboptions:
639 count:
640 description: Maximum number of traps sent per interval
641 type: int
642 interval:
643 description: Interval duration in which to limit the number of traps sent
644 type: int
645 enable:
646 description: Enable/disable subif traps
647 type: bool
648 type: dict
649 type: dict
650 fru_ctrl:
651 description: Enable SNMP fru-ctrl traps
652 type: bool
653 hsrp:
654 description: Enable SNMP hsrp traps
655 type: bool
656 ike:
657 description: Allow ike traps
658 suboptions:
659 policy:
660 description: Enable IKE Policy traps
661 suboptions:
662 add:
663 description: Enable IKE Policy add trap
664 type: bool
665 delete:
666 description: Enable IKE Policy delete trap
667 type: bool
668 type: dict
669 tunnel:
670 description: Enable IKE Tunnel traps
671 suboptions:
672 start:
673 description: Enable IKE Tunnel start trap
674 type: bool
675 stop:
676 description: Enable IKE Tunnel stop trap
677 type: bool
678 type: dict
679 type: dict
680 ipmulticast:
681 description: Enable SNMP ip multi cast traps
682 type: bool
683 ipsec:
684 description: Allow ike traps
685 suboptions:
686 cryptomap:
687 description: Enable IPsec Cryptomap traps
688 suboptions:
689 add:
690 description: Enable IPsec Cryptomap add trap
691 type: bool
692 attach:
693 description: Enable IPsec Cryptomap Attach trap
694 type: bool
695 delete:
696 description: Enable IPsec Cryptomap delete trap
697 type: bool
698 detach:
699 description: Enable IPsec Cryptomap Detach trap
700 type: bool
701 type: dict
702 too_many_sas:
703 description: Enable IPsec Tunnel Start trap
704 type: bool
705 tunnel:
706 description: Enable IPsec Tunnel traps
707 suboptions:
708 start:
709 description: Enable IPsec Tunnel start trap
710 type: bool
711 stop:
712 description: Enable IPsec Tunnel stop trap
713 type: bool
714 type: dict
715 type: dict
716 ipsla:
717 description: Enable SNMP ipsla traps
718 type: bool
719 isis:
720 description: Enable SNMP isis traps
721 type: bool
722 l2tc:
723 description: Allow SNMP L2 Tunnel Config traps
724 suboptions:
725 enable:
726 description: Enable SNMP L2 Tunnel Config traps
727 type: bool
728 sys_threshold:
729 description: Enable SNMP L2TC System threshold traps
730 type: bool
731 threshold:
732 description: Enable SNMP L2 Tunnel Config threshold traps
733 type: bool
734 type: dict
735 l2tun:
736 description: Allow SNMP l2tun traps
737 suboptions:
738 pseudowire_status:
739 description: Enable BFD pseudo wire status traps
740 type: bool
741 session:
742 description: Enable BFD session traps
743 type: bool
744 type: dict
745 license:
746 description: Enable license traps
747 type: bool
748 lisp:
749 description: Enable SNMP LISP MIB traps
750 type: bool
751 local_auth:
752 description: Enable SNMP local auth traps
753 type: bool
754 mac_notification:
755 description: Allow SNMP MAC Notification traps
756 suboptions:
757 enable:
758 description: Enable SNMP MAC Notification traps
759 type: bool
760 change:
761 description: Enable SNMP MAC Change traps
762 type: bool
763 move:
764 description: Enable SNMP MAC Move traps
765 type: bool
766 threshold:
767 description: Enable SNMP MAC Threshold traps
768 type: bool
769 type: dict
770 memory:
771 description: Allow MEMORY traps
772 suboptions:
773 enable:
774 description: Enable MEMORY traps
775 type: bool
776 bufferpeak:
777 description: Enable SNMP Memory Bufferpeak traps
778 type: bool
779 type: dict
780 mpls:
781 description: Enable SNMP mpls traps
782 suboptions:
783 fast_reroute:
784 description: Allow SNMP MPLS fast reroute traps
785 suboptions:
786 enable:
787 description: Enable SNMP MPLS fast reroute traps
788 type: bool
789 protected:
790 description: Enable MPLS fast reroute protection traps
791 type: bool
792 type: dict
793 ldp:
794 description: Allow SNMP MPLS label distribution protocol traps
795 suboptions:
796 enable:
797 description: Enable SNMP MPLS label distribution protocol traps
798 type: bool
799 pv_limit:
800 description: Enable MPLS LDP path vector limit mismatch traps
801 type: bool
802 session_down:
803 description: Enable MPLS LDP session down traps
804 type: bool
805 session_up:
806 description: Enable MPLS LDP session up traps
807 type: bool
808 threshold:
809 description: Enable MPLS LDP threshold exceeded traps
810 type: bool
811 type: dict
812 rfc:
813 description: Enable SNMP MPLS RFC traps
814 suboptions:
815 ldp:
816 description: Allow SNMP MPLS label distribution protocol RFC traps
817 suboptions:
818 enable:
819 description: Enable SNMP MPLS label distribution protocol RFC traps
820 type: bool
821 pv_limit:
822 description: Enable MPLS LDP path vector limit mismatch RFC traps
823 type: bool
824 session_down:
825 description: Enable MPLS LDP session down RFC traps
826 type: bool
827 session_up:
828 description: Enable MPLS LDP session up RFC traps
829 type: bool
830 threshold:
831 description: Enable MPLS LDP threshold exceeded RFC traps
832 type: bool
833 type: dict
834 traffic_eng:
835 description: Allow SNMP MPLS traffic engineering RFC traps
836 suboptions:
837 enable:
838 description: Enable SNMP MPLS traffic engineering RFC traps
839 type: bool
840 down:
841 description: Enable MPLS TE tunnel down RFC traps
842 type: bool
843 reoptimized:
844 description: Enable MPLS TE tunnel reoptimized RFC traps
845 type: bool
846 reroute:
847 description: Enable MPLS TE tunnel reroute RFC traps
848 type: bool
849 up:
850 description: Enable MPLS TE tunnel up RFC traps
851 type: bool
852 type: dict
853 vpn:
854 description: Allow SNMP MPLS Virtual Private Network RFC traps
855 suboptions:
856 enable:
857 description: Enable SNMP MPLS Virtual Private Network RFC traps
858 type: bool
859 illegal_label:
860 description: Enable MPLS VPN illegal label threshold exceeded RFC traps
861 type: bool
862 max_thresh_cleared:
863 description: Enable MPLS VPN maximum threshold cleared RFC traps
864 type: bool
865 max_threshold:
866 description: Enable MPLS VPN maximum threshold exceeded RFC traps
867 type: bool
868 mid_threshold:
869 description: Enable MPLS VPN middle threshold exceeded RFC traps
870 type: bool
871 vrf_down:
872 description: Enable MPLS VPN vrf down RFC traps
873 type: bool
874 vrf_up:
875 description: Enable MPLS VPN vrf up RFC traps
876 type: bool
877 type: dict
878 type: dict
879 traffic_eng:
880 description: Allow SNMP MPLS traffic engineering traps
881 suboptions:
882 enable:
883 description: Enable SNMP MPLS traffic engineering traps
884 type: bool
885 down:
886 description: Enable MPLS TE tunnel down traps
887 type: bool
888 reroute:
889 description: Enable MPLS TE tunnel reroute traps
890 type: bool
891 up:
892 description: Enable MPLS TE tunnel up traps
893 type: bool
894 type: dict
895 vpn:
896 description: Allow SNMP MPLS Virtual Private Network traps
897 suboptions:
898 enable:
899 description: Enable SNMP MPLS Virtual Private Network traps
900 type: bool
901 illegal_label:
902 description: Enable MPLS VPN illegal label threshold exceeded traps
903 type: bool
904 max_thresh_cleared:
905 description: Enable MPLS VPN maximum threshold cleared traps
906 type: bool
907 max_threshold:
908 description: Enable MPLS VPN maximum threshold exceeded traps
909 type: bool
910 mid_threshold:
911 description: Enable MPLS VPN middle threshold exceeded traps
912 type: bool
913 vrf_down:
914 description: Enable MPLS VPN vrf down traps
915 type: bool
916 vrf_up:
917 description: Enable MPLS VPN vrf up traps
918 type: bool
919 type: dict
920 type: dict
921 mpls_vpn:
922 description:
923 - Enable SNMP mpls traps
924 - This option is DEPRECATED and is replaced with mpls which accepts dict as input
925 - This attribute will be removed after 2024-09-01
926 type: bool
927 msdp:
928 description: Enable SNMP msdp traps
929 type: bool
930 mvpn:
931 description: Enable SNMP mvpn traps
932 type: bool
933 nhrp:
934 description: Allow SNMP NHRP traps
935 suboptions:
936 enable:
937 description: Enable SNMP NHRP traps
938 type: bool
939 nhc:
940 description: Allow Next Hop Client traps
941 suboptions:
942 enable:
943 description: Enable Next Hop Client traps
944 type: bool
945 down:
946 description: Enable Next Hop Client down trap
947 type: bool
948 up:
949 description: Enable Next Hop Client up trap
950 type: bool
951 type: dict
952 nhp:
953 description: Allow Next Hop Peer traps
954 suboptions:
955 enable:
956 description: Enable Next Hop Peer traps
957 type: bool
958 down:
959 description: Enable Next Hop Peer down trap
960 type: bool
961 up:
962 description: Enable Next Hop Peer up trap
963 type: bool
964 type: dict
965 nhs:
966 description: Allow Next Hop Server traps
967 suboptions:
968 enable:
969 description: Enable Next Hop Server traps
970 type: bool
971 down:
972 description: Enable Next Hop Server down trap
973 type: bool
974 up:
975 description: Enable Next Hop Server up trap
976 type: bool
977 type: dict
978 quota_exceeded:
979 description: Enable quota-exceeded trap
980 type: bool
981 type: dict
982 ospf:
983 description: Allow ospf related traps
984 suboptions:
985 cisco_specific:
986 description: Cisco specific traps
987 suboptions:
988 error:
989 description: error traps
990 type: bool
991 lsa:
992 description: Lsa related traps
993 type: bool
994 retransmit:
995 description: Packet retransmit traps
996 type: bool
997 state_change:
998 description: state change traps
999 suboptions:
1000 nssa_trans_change:
1001 description: Nssa translator state changes
1002 type: bool
1003 shamlink:
1004 description: Config mismatch errors on virtual interfaces
1005 suboptions:
1006 interface:
1007 description: Sham link interface state changes
1008 type: bool
1009 neighbor:
1010 description: Sham link neighbor state changes
1011 type: bool
1012 type: dict
1013 type: dict
1014 type: dict
1015 error:
1016 description: Enable error traps
1017 type: bool
1018 retransmit:
1019 description: Enable/disable ospf retransmit traps
1020 type: bool
1021 lsa:
1022 description: Enable/disable ospf lsa traps
1023 type: bool
1024 state_change:
1025 description: Enable/disable state change traps
1026 type: bool
1027 type: dict
1028 ospfv3:
1029 description: Allow OSPFv3 related traps
1030 suboptions:
1031 errors:
1032 description: Error traps
1033 suboptions:
1034 enable:
1035 description: Enable Error traps
1036 type: bool
1037 bad_packet:
1038 description: Packet parse failure on non-virtual interfaces
1039 type: bool
1040 config_error:
1041 description: Config mismatch errors on non-virtual interfaces
1042 type: bool
1043 virt_bad_packet:
1044 description: Packet parse failure on virtual interfaces
1045 type: bool
1046 virt_config_error:
1047 description: Config mismatch errors on virtual interfaces
1048 type: bool
1049 type: dict
1050 rate_limit:
1051 description:
1052 - Trap rate limit values
1053 - Rate limit window size in seconds (between 2 and 60)
1054 type: int
1055 state_change:
1056 description: State change traps
1057 suboptions:
1058 enable:
1059 description: Enable State change traps
1060 type: bool
1061 if_state_change:
1062 description: Non_virtual interface state changes
1063 type: bool
1064 neighbor_restart_helper_status_change:
1065 description: Neighbor graceful restart helper status changes
1066 type: bool
1067 neighbor_state_change:
1068 description: Non_virtual neighbor state changes
1069 type: bool
1070 nssa_translator_status_change:
1071 description: NSSA translator status changes
1072 type: bool
1073 restart_status_change:
1074 description: Graceful restart status changes
1075 type: bool
1076 virtif_state_change:
1077 description: Virtual interface state changes
1078 type: bool
1079 vn_restart_helper_status_change:
1080 description: Virtual neighbor graceful restart helper status changes
1081 type: bool
1082 vn_state_change:
1083 description: Virtual neighbor state changes
1084 type: bool
1085 type: dict
1086 type: dict
1087 pim:
1088 description: Allow PIM traps
1089 suboptions:
1090 invalid_pim_message:
1091 description: Enable invalid pim message trap
1092 type: bool
1093 neighbor_change:
1094 description: Enable neighbor change trap
1095 type: bool
1096 rp_mapping_change:
1097 description: Enable rp mapping change trap
1098 type: bool
1099 enable:
1100 description: Enable/disable PIM traps
1101 type: bool
1102 type: dict
1103 pki:
1104 description: Enable SNMP pki traps
1105 type: bool
1106 port_security:
1107 description: Enable SNMP port security traps
1108 type: bool
1109 power_ethernet:
1110 description: Allow SNMP power ethernet traps
1111 suboptions:
1112 enable:
1113 description: Enable SNMP power ethernet traps
1114 type: bool
1115 group:
1116 description: Enable SNMP inline power group based traps.
1117 suboptions:
1118 slot_id:
1119 description: An integer between 1 and 20 (physical slot number)
1120 type: int
1121 threshold:
1122 description: Threshold level for this slot
1123 type: int
1124 elements: dict
1125 type: list
1126 police:
1127 description: Enable Policing Trap
1128 type: bool
1129 type: dict
1130 pw_vc:
1131 description: Enable SNMP pw vc traps
1132 type: bool
1133 rep:
1134 description: Enable SNMP Resilient Ethernet Protocol Traps
1135 type: bool
1136 rsvp:
1137 description: Enable SNMP RSVP traps
1138 type: bool
1139 rf:
1140 description: Enable all SNMP traps defined in CISCO-RF-MIB
1141 type: bool
1142 smart_license:
1143 description: Allow smart license traps
1144 suboptions:
1145 enable:
1146 description: Enable smart license traps
1147 type: bool
1148 entitlement:
1149 description: Enable Entitlement Notification trap
1150 type: bool
1151 global:
1152 description: Enable Global Notification traps
1153 type: bool
1154 type: dict
1155 snmp:
1156 description: Enable SNMP traps
1157 suboptions:
1158 authentication:
1159 description: Enable authentication trap
1160 type: bool
1161 coldstart:
1162 description: Enable coldStart trap
1163 type: bool
1164 linkdown:
1165 description: Enable linkDown trap
1166 type: bool
1167 linkup:
1168 description: Enable linkUp trap
1169 type: bool
1170 warmstart:
1171 description: Enable warmStart trap
1172 type: bool
1173 type: dict
1174 stackwise:
1175 description: Enable SNMP stackwise traps
1176 type: bool
1177 stpx:
1178 description: Allow SNMP STPX MIB traps
1179 suboptions:
1180 enable:
1181 description: Enable SNMP STPX MIB traps
1182 type: bool
1183 inconsistency:
1184 description: Enable SNMP STPX MIB InconsistencyUpdate traps
1185 type: bool
1186 loop_inconsistency:
1187 description: Enable SNMP STPX MIB LoopInconsistencyUpdate traps
1188 type: bool
1189 root_inconsistency:
1190 description: Enable SNMP STPX MIB RootInconsistencyUpdate traps
1191 type: bool
1192 type: dict
1193 syslog:
1194 description: Enable SNMP syslog traps
1195 type: bool
1196 transceiver_all:
1197 description: Enable SNMP transceiver traps
1198 type: bool
1199 trustsec:
1200 description: Allow SNMP CISCO-TRUSTSEC-MIB traps
1201 suboptions:
1202 authz_file_error:
1203 description: Enable ctsAuthzCacheFileErrNotif notifications
1204 type: bool
1205 cache_file_error:
1206 description: Enable ctsCacheFileAccessErrNotif notifications
1207 type: bool
1208 enable:
1209 description: Enable SNMP CISCO-TRUSTSEC-MIB traps
1210 type: bool
1211 keystore_file_error:
1212 description: Enable ctsSwKeystoreFileErrNotif notifications
1213 type: bool
1214 keystore_sync_fail:
1215 description: Enable ctsSwKeystoreSyncFailNotif notifications
1216 type: bool
1217 random_number_fail:
1218 description: Enable ctsSapRandonNumberFailNotif notifications
1219 type: bool
1220 src_entropy_fail:
1221 description: Enable ctsSrcEntropyFailNotif notifications
1222 type: bool
1223 type: dict
1224 trustsec_interface:
1225 description: Allow SNMP CISCO-TRUSTSEC-INTERFACE-MIB traps
1226 suboptions:
1227 enable:
1228 description: Enable SNMP CISCO-TRUSTSEC-INTERFACE-MIB traps
1229 type: bool
1230 authc_fail:
1231 description: Enable ctsiIfAuthenticationFailNotif trap
1232 type: bool
1233 authz_fail:
1234 description: Enable ctsiAuthorizationFailNotif trap
1235 type: bool
1236 sap_fail:
1237 description: Enable ctsiIfSapNegotiationFailNotif trap
1238 type: bool
1239 supplicant_fail:
1240 description: Enable ctsiIfAddSupplicantFailNotif trap
1241 type: bool
1242 unauthorized:
1243 description: Enable ctsiIfUnauthorizedNotifEnable trap
1244 type: bool
1245 type: dict
1246 trustsec_policy:
1247 description: Allow SNMP CISCO-TRUSTSEC-POLICY-MIB traps
1248 suboptions:
1249 enable:
1250 description: Enable SNMP CISCO-TRUSTSEC-POLICY-MIB traps
1251 type: bool
1252 authz_sgacl_fail:
1253 description: Enable ctspAuthorizationSgaclFailNotif notifications
1254 type: bool
1255 peer_policy_updated:
1256 description: Enable ctspPeerPolicyUpdatedNotif notifications
1257 type: bool
1258 type: dict
1259 trustsec_server:
1260 description: Allow SNMP CISCO-TRUSTSEC-SERVER-MIB traps
1261 suboptions:
1262 enable:
1263 description: Enable SNMP CISCO-TRUSTSEC-SERVER-MIB traps
1264 type: bool
1265 provision_secret:
1266 description: Enable ctsvNoProvisionSecretNotif notification
1267 type: bool
1268 radius_server:
1269 description: Enable ctsvNoRadiusServerNotif notification
1270 type: bool
1271 type: dict
1272 trustsec_sxp:
1273 description: Allow SNMP CISCO-TRUSTSEC-SXP-MIB traps
1274 suboptions:
1275 enable:
1276 description: Enable SNMP CISCO-TRUSTSEC-SXP-MIB traps
1277 type: bool
1278 binding_conflict:
1279 description: Enable ctsxSxpBindingConflictNotif notifications
1280 type: bool
1281 binding_err:
1282 description: Enable ctsxSxpBindingErrNotif notifications
1283 type: bool
1284 binding_expn_fail:
1285 description: Enable ctsxSxpBindingExpnFailNotif notifications
1286 type: bool
1287 conn_config_err:
1288 description: Enable ctsxSxpConnConfigErrNotif notifications
1289 type: bool
1290 conn_down:
1291 description: Enable ctsxSxpConnDownNotif notifications
1292 type: bool
1293 conn_srcaddr_err:
1294 description: Enable ctsxSxpConnSourceAddrErrNotif notifications
1295 type: bool
1296 conn_up:
1297 description: Enable ctsxSxpConnUpNotif notifications
1298 type: bool
1299 msg_parse_err:
1300 description: Enable ctsxSxpMsgParseErrNotif notifications
1301 type: bool
1302 oper_nodeid_change:
1303 description: Enable ctsxSxpOperNodeIdChangeNotif notifications
1304 type: bool
1305 type: dict
1306 tty:
1307 description: Enable SNMP tty TCP connection traps
1308 type: bool
1309 udld:
1310 description: Allow SNMP CISCO-UDLDP-MIB traps
1311 suboptions:
1312 enable:
1313 description: Enable SNMP CISCO-UDLDP-MIB traps
1314 type: bool
1315 link_fail_rpt:
1316 description: Enable SNMP cudldpFastHelloLinkFailRptNotification traps
1317 type: bool
1318 status_change:
1319 description: Enable SNMP cudldpFastHelloStatusChangeNotification traps
1320 type: bool
1321 type: dict
1322 vlan_membership:
1323 description: Enable SNMP VLAN membership traps
1324 type: bool
1325 vlancreate:
1326 description: Enable SNMP VLAN created traps
1327 type: bool
1328 vlandelete:
1329 description: Enable SNMP VLAN deleted traps
1330 type: bool
1331 vrfmib:
1332 description: Allow vrfmib traps
1333 suboptions:
1334 vrf_up:
1335 description: Enable vrf-up trap
1336 type: bool
1337 vrf_down:
1338 description: Enable vrf-down trap
1339 type: bool
1340 vnet_trunk_up:
1341 description: Enable vnet-trunk-up trap
1342 type: bool
1343 vnet_trunk_down:
1344 description: Enable vnet-trunk-down traps
1345 type: bool
1346 type: dict
1347 vrrp:
1348 description: Enable SNMP vrrp traps
1349 type: bool
1350 vswitch:
1351 description: Allow SNMP Virtual Switch notifications
1352 suboptions:
1353 dual_active:
1354 description: Enable SNMP Virtual Switch (Dual Active) notification
1355 type: bool
1356 enable:
1357 description: Enable SNMP Virtual Switch notifications
1358 type: bool
1359 vsl:
1360 description: Enable SNMP Virtual Switch Link (VSL) notification
1361 type: bool
1362 type: dict
1363 vtp:
1364 description: Enable SNMP VTP traps
1365 type: bool
1366 type: dict
1367 users:
1368 description: Define a user who can access the SNMP engine
1369 elements: dict
1370 suboptions:
1371 acl_v6:
1372 description: Access list ipv6 associated
1373 type: str
1374 acl_v4:
1375 description: Access list ipv4 associated
1376 type: str
1377 authentication:
1378 description:
1379 - Authentication parameters for the user.
1380 - Effects idempotency of module as configuration applied is not reflected
1381 in running-config.
1382 type: dict
1383 suboptions:
1384 algorithm:
1385 description: Select algorithm for authentication.
1386 type: str
1387 choices: ["md5", "sha", "sha-2"]
1388 auth_option:
1389 description: Add extra option for specific auth algorithm if any (e.g.256, 384, 512 for sha-2).
1390 type: int
1391 password:
1392 description:
1393 - Authentication password for user.
1394 type: str
1395 encryption:
1396 description:
1397 - Encryption parameters for the user.
1398 - Effects idempotency of module as configuration applied is not reflected
1399 in running-config.
1400 type: dict
1401 suboptions:
1402 priv:
1403 description: Select algorithm for encryption.
1404 type: str
1405 choices: ["3des", "aes", "des"]
1406 priv_option:
1407 description: Add extra option for specific priv if any.
1408 type: str
1409 password:
1410 description:
1411 - Authentication password for user.
1412 type: str
1413 group:
1414 description: SNMP group for the user.
1415 type: str
1416 remote:
1417 description: System where an SNMPv3 user is hosted
1418 type: str
1419 udp_port:
1420 description: UDP port used by the remote SNMP system
1421 type: int
1422 username:
1423 description: SNMP user name
1424 type: str
1425 version:
1426 choices:
1427 - v1
1428 - v2c
1429 - v3
1430 description: SNMP security version
1431 type: str
1432 version_option:
1433 choices:
1434 - encrypted
1435 description: Enable encrypted version option.
1436 type: str
1437 vrf:
1438 description: The remote SNMP entity's VPN Routing instance
1439 type: str
1440 type: list
1441 views:
1442 description: Define an SNMPv2 MIB view
1443 elements: dict
1444 suboptions:
1445 excluded:
1446 description: MIB family is excluded from the view
1447 type: bool
1448 family_name:
1449 description: MIB view family name
1450 type: str
1451 included:
1452 description: MIB family is included in the view
1453 type: bool
1454 name:
1455 description: Name of the view
1456 type: str
1457 type: list
1458 type: dict
1459 running_config:
1460 description:
1461 - This option is used only with state I(parsed).
1462 - The value of this option should be the output received from the IOS device by
1463 executing the command B(show running-config | include snmp-server).
1464 - The state I(parsed) reads the configuration from C(running_config) option and
1465 transforms it into Ansible structured data as per the resource module's argspec
1466 and the value is then returned in the I(parsed) key within the result.
1467 type: str
1468 state:
1469 choices:
1470 - merged
1471 - replaced
1472 - overridden
1473 - deleted
1474 - parsed
1475 - gathered
1476 - rendered
1477 default: merged
1478 description:
1479 - The state the configuration should be left in.
1480 - Refer to examples for more details.
1481 - The states I(replaced) and I(overridden) have identical
1482 behaviour for this module.
1483 type: str
1484 short_description: Resource module to configure snmp server.
1485 version_added: 2.6.0
1486 """
1487
1488 EXAMPLES = """
1489 # Using state: merged
1490
1491 # Before state:
1492 # -------------
1493
1494 # router-ios#show running-config | section ^snmp-server
1495 # --------------------- EMPTY -----------------
1496
1497 # Merged play:
1498 # ------------
1499
1500 - name: Apply the provided configuration
1501 cisco.ios.ios_snmp_server:
1502 config:
1503 communities:
1504 - acl_v4: testACL
1505 name: mergedComm
1506 rw: true
1507 contact: contact updated using merged
1508 engine_id:
1509 - id: AB0C5342FF0F
1510 remote:
1511 host: 172.16.0.12
1512 udp_port: 25
1513 groups:
1514 - group: mergedGroup
1515 version: v3
1516 version_option: auth
1517 file_transfer:
1518 access_group: test
1519 protocol:
1520 - ftp
1521 hosts:
1522 - community_string: mergedComm
1523 host: 172.16.2.9
1524 informs: true
1525 traps:
1526 - msdp
1527 - stun
1528 - pki
1529 version: 2c
1530 - community_string: mergedComm
1531 host: 172.16.2.9
1532 traps:
1533 - slb
1534 - pki
1535 password_policy:
1536 - change: 3
1537 digits: 23
1538 lower_case: 12
1539 max_len: 24
1540 policy_name: MergedPolicy
1541 special_char: 32
1542 upper_case: 12
1543 - change: 43
1544 min_len: 12
1545 policy_name: MergedPolicy2
1546 special_char: 22
1547 upper_case: 12
1548 - change: 11
1549 digits: 23
1550 max_len: 12
1551 min_len: 12
1552 policy_name: policy3
1553 special_char: 22
1554 upper_case: 12
1555 traps:
1556 cef:
1557 enable: true
1558 inconsistency: true
1559 peer_fib_state_change: true
1560 peer_state_change: true
1561 resource_failure: true
1562 msdp: true
1563 ospf:
1564 cisco_specific:
1565 error: true
1566 lsa: true
1567 retransmit: true
1568 state_change:
1569 nssa_trans_change: true
1570 shamlink:
1571 interface: true
1572 neighbor: true
1573 error: true
1574 lsa: true
1575 retransmit: true
1576 state_change: true
1577 syslog: true
1578 tty: true
1579 users:
1580 - acl_v4: "24"
1581 group: dev
1582 username: userPaul
1583 version: v1
1584 state: merged
1585
1586 # Commands Fired:
1587 # ---------------
1588
1589 # "commands": [
1590 # "snmp-server contact contact updated using merged",
1591 # "snmp-server file-transfer access-group test protocol ftp",
1592 # "snmp-server enable traps msdp",
1593 # "snmp-server enable traps syslog",
1594 # "snmp-server enable traps tty",
1595 # "snmp-server enable traps ospf cisco-specific errors",
1596 # "snmp-server enable traps ospf cisco-specific retransmit",
1597 # "snmp-server enable traps ospf cisco-specific lsa",
1598 # "snmp-server enable traps ospf cisco-specific state-change nssa-trans-change",
1599 # "snmp-server enable traps ospf cisco-specific state-change shamlink interface",
1600 # "snmp-server enable traps ospf cisco-specific state-change shamlink neighbor",
1601 # "snmp-server enable traps ospf errors",
1602 # "snmp-server enable traps ospf retransmit",
1603 # "snmp-server enable traps ospf lsa",
1604 # "snmp-server enable traps ospf state-change",
1605 # "snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency",
1606 # "snmp-server host 172.16.2.9 informs version 2c mergedComm msdp stun pki",
1607 # "snmp-server host 172.16.2.9 mergedComm slb pki",
1608 # "snmp-server group mergedGroup v3 auth",
1609 # "snmp-server engineID remote 172.16.0.12 udp-port 25 AB0C5342FF0F",
1610 # "snmp-server community mergedComm rw testACL",
1611 # "snmp-server password-policy MergedPolicy define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3",
1612 # "snmp-server password-policy MergedPolicy2 define min-len 12 upper-case 12 special-char 22 change 43",
1613 # "snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11",
1614 # "snmp-server user userPaul dev v1 access 24"
1615 # ],
1616
1617 # After state:
1618 # ------------
1619
1620 # router-ios#show running-config | section ^snmp-server
1621 # snmp-server engineID remote 172.16.0.12 udp-port 25 AB0C5342FF0F
1622 # snmp-server user userPaul dev v1 access 24
1623 # snmp-server group mergedGroup v3 auth
1624 # snmp-server community mergedComm RW testACL
1625 # snmp-server contact contact updated using merged
1626 # snmp-server enable traps tty
1627 # snmp-server enable traps ospf state-change
1628 # snmp-server enable traps ospf errors
1629 # snmp-server enable traps ospf retransmit
1630 # snmp-server enable traps ospf lsa
1631 # snmp-server enable traps ospf cisco-specific state-change nssa-trans-change
1632 # snmp-server enable traps ospf cisco-specific state-change shamlink interface
1633 # snmp-server enable traps ospf cisco-specific state-change shamlink neighbor
1634 # snmp-server enable traps ospf cisco-specific errors
1635 # snmp-server enable traps ospf cisco-specific retransmit
1636 # snmp-server enable traps ospf cisco-specific lsa
1637 # snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency
1638 # snmp-server enable traps msdp
1639 # snmp-server enable traps syslog
1640 # snmp-server host 172.16.2.9 informs version 2c mergedComm msdp stun pki
1641 # snmp-server host 172.16.2.9 mergedComm slb pki
1642 # snmp-server file-transfer access-group test protocol ftp
1643 # snmp-server password-policy MergedPolicy define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3
1644 # snmp-server password-policy MergedPolicy2 define min-len 12 upper-case 12 special-char 22 change 43
1645 # snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11
1646
1647 # Using merged to configure SNMPv3 user with SHA-2 authentication
1648 # ----------------------------------------------------------------
1649
1650 # Before state:
1651 # -------------
1652
1653 # router-ios#show running-config | section ^snmp-server
1654 # snmp-server group groupv3 v3 auth
1655
1656 # Merged play:
1657 # ------------
1658
1659 - name: Configure SNMPv3 user with SHA-2 authentication
1660 cisco.ios.ios_snmp_server:
1661 config:
1662 users:
1663 - username: test_ansible
1664 group: groupv3
1665 version: v3
1666 authentication:
1667 algorithm: sha-2
1668 auth_option: 256
1669 password: test_pass123
1670 state: merged
1671
1672 # Commands Fired:
1673 # ---------------
1674
1675 # "commands": [
1676 # "snmp-server user test_ansible groupv3 v3 auth sha-2 256 test_pass123"
1677 # ]
1678
1679 # After state:
1680 # ------------
1681
1682 # router-ios#show running-config | section ^snmp-server
1683 # snmp-server group groupv3 v3 auth
1684 # snmp-server user test_ansible groupv3 v3 auth sha-2 256 <password>
1685
1686 # Using state: deleted
1687
1688 # Before state:
1689 # -------------
1690
1691 # router-ios#show running-config | section ^snmp-server
1692 # snmp-server engineID remote 172.16.0.12 udp-port 25 AB0C5342FF0F
1693 # snmp-server user userPaul dev v1 access 24
1694 # snmp-server group mergedGroup v3 auth
1695 # snmp-server community mergedComm RW testACL
1696 # snmp-server contact contact updated using merged
1697 # snmp-server enable traps tty
1698 # snmp-server enable traps ospf state-change
1699 # snmp-server enable traps ospf errors
1700 # snmp-server enable traps ospf retransmit
1701 # snmp-server enable traps ospf lsa
1702 # snmp-server enable traps ospf cisco-specific state-change nssa-trans-change
1703 # snmp-server enable traps ospf cisco-specific state-change shamlink interface
1704 # snmp-server enable traps ospf cisco-specific state-change shamlink neighbor
1705 # snmp-server enable traps ospf cisco-specific errors
1706 # snmp-server enable traps ospf cisco-specific retransmit
1707 # snmp-server enable traps ospf cisco-specific lsa
1708 # snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency
1709 # snmp-server enable traps msdp
1710 # snmp-server enable traps syslog
1711 # snmp-server host 172.16.2.9 informs version 2c mergedComm msdp stun pki
1712 # snmp-server host 172.16.2.9 mergedComm slb pki
1713 # snmp-server file-transfer access-group test protocol ftp
1714 # snmp-server password-policy MergedPolicy define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3
1715 # snmp-server password-policy MergedPolicy2 define min-len 12 upper-case 12 special-char 22 change 43
1716 # snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11
1717
1718 # Deleted play:
1719 # -------------
1720
1721 - name: Remove all existing configuration
1722 cisco.ios.ios_snmp_server:
1723 state: deleted
1724
1725 # Commands Fired:
1726 # ---------------
1727
1728 # "commands": [
1729 # "no snmp-server contact contact updated using merged",
1730 # "no snmp-server file-transfer access-group test protocol ftp",
1731 # "no snmp-server enable traps msdp",
1732 # "no snmp-server enable traps syslog",
1733 # "no snmp-server enable traps tty",
1734 # "no snmp-server enable traps ospf cisco-specific errors",
1735 # "no snmp-server enable traps ospf cisco-specific retransmit",
1736 # "no snmp-server enable traps ospf cisco-specific lsa",
1737 # "no snmp-server enable traps ospf cisco-specific state-change nssa-trans-change",
1738 # "no snmp-server enable traps ospf cisco-specific state-change shamlink interface",
1739 # "no snmp-server enable traps ospf cisco-specific state-change shamlink neighbor",
1740 # "no snmp-server enable traps ospf errors",
1741 # "no snmp-server enable traps ospf retransmit",
1742 # "no snmp-server enable traps ospf lsa",
1743 # "no snmp-server enable traps ospf state-change",
1744 # "no snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency",
1745 # "no snmp-server host 172.16.2.9 informs version 2c mergedComm msdp stun pki",
1746 # "no snmp-server host 172.16.2.9 mergedComm slb pki",
1747 # "no snmp-server group mergedGroup v3 auth",
1748 # "no snmp-server engineID remote 172.16.0.12 udp-port 25 AB0C5342FF0F",
1749 # "no snmp-server community mergedComm rw testACL",
1750 # "no snmp-server password-policy MergedPolicy define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3",
1751 # "no snmp-server password-policy MergedPolicy2 define min-len 12 upper-case 12 special-char 22 change 43",
1752 # "no snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11",
1753 # "no snmp-server user userPaul dev v1 access 24"
1754 # ],
1755
1756 # After state:
1757 # ------------
1758
1759 # router-ios#show running-config | section ^snmp-server
1760 # --------------------- EMPTY -----------------
1761
1762 # Using state: overridden
1763
1764 # Before state:
1765 # -------------
1766
1767 # router-ios#show running-config | section ^snmp-server
1768 # snmp-server engineID remote 172.16.0.12 udp-port 25 AB0C5342FF0F
1769 # snmp-server user userPaul dev v1 access 24
1770 # snmp-server group mergedGroup v3 auth
1771 # snmp-server community mergedComm RW testACL
1772 # snmp-server contact contact updated using merged
1773 # snmp-server enable traps tty
1774 # snmp-server enable traps ospf state-change
1775 # snmp-server enable traps ospf errors
1776 # snmp-server enable traps ospf retransmit
1777 # snmp-server enable traps ospf lsa
1778 # snmp-server enable traps ospf cisco-specific state-change nssa-trans-change
1779 # snmp-server enable traps ospf cisco-specific state-change shamlink interface
1780 # snmp-server enable traps ospf cisco-specific state-change shamlink neighbor
1781 # snmp-server enable traps ospf cisco-specific errors
1782 # snmp-server enable traps ospf cisco-specific retransmit
1783 # snmp-server enable traps ospf cisco-specific lsa
1784 # snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency
1785 # snmp-server enable traps msdp
1786 # snmp-server enable traps syslog
1787 # snmp-server host 172.16.2.9 informs version 2c mergedComm msdp stun pki
1788 # snmp-server host 172.16.2.9 mergedComm slb pki
1789 # snmp-server file-transfer access-group test protocol ftp
1790 # snmp-server password-policy MergedPolicy define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3
1791 # snmp-server password-policy MergedPolicy2 define min-len 12 upper-case 12 special-char 22 change 43
1792 # snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11
1793
1794 # Overridden play:
1795 # ----------------
1796
1797 - name: Override commands with provided configuration
1798 cisco.ios.ios_snmp_server:
1799 config:
1800 location: "location entry for snmp"
1801 packet_size: 500
1802 communities:
1803 - acl_v4: acl_uq
1804 name: communityOverriden
1805 rw: true
1806 state: overridden
1807
1808 # Commands Fired:
1809 # ---------------
1810 # "commands": [
1811 # "no snmp-server contact contact updated using merged",
1812 # "no snmp-server file-transfer access-group test protocol ftp",
1813 # "snmp-server location location entry for snmp",
1814 # "snmp-server packetsize 500",
1815 # "no snmp-server enable traps msdp",
1816 # "no snmp-server enable traps syslog",
1817 # "no snmp-server enable traps tty",
1818 # "no snmp-server enable traps ospf cisco-specific errors",
1819 # "no snmp-server enable traps ospf cisco-specific retransmit",
1820 # "no snmp-server enable traps ospf cisco-specific lsa",
1821 # "no snmp-server enable traps ospf cisco-specific state-change nssa-trans-change",
1822 # "no snmp-server enable traps ospf cisco-specific state-change shamlink interface",
1823 # "no snmp-server enable traps ospf cisco-specific state-change shamlink neighbor",
1824 # "no snmp-server enable traps ospf errors",
1825 # "no snmp-server enable traps ospf retransmit",
1826 # "no snmp-server enable traps ospf lsa",
1827 # "no snmp-server enable traps ospf state-change",
1828 # "no snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency",
1829 # "no snmp-server host 172.16.2.9 informs version 2c mergedComm msdp stun pki",
1830 # "no snmp-server host 172.16.2.9 mergedComm slb pki",
1831 # "no snmp-server group mergedGroup v3 auth",
1832 # "no snmp-server engineID remote 172.16.0.12 udp-port 25 AB0C5342FF0F",
1833 # "snmp-server community communityOvverriden rw acl_uq",
1834 # "no snmp-server community mergedComm rw testACL",
1835 # "no snmp-server password-policy MergedPolicy define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3",
1836 # "no snmp-server password-policy MergedPolicy2 define min-len 12 upper-case 12 special-char 22 change 43",
1837 # "no snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11",
1838 # "no snmp-server user userPaul dev v1 access 24"
1839 # ],
1840
1841 # After state:
1842 # ------------
1843
1844 # router-ios#show running-config | section ^snmp-server
1845 # snmp-server community communityOverriden RW acl_uq
1846 # snmp-server packetsize 500
1847 # snmp-server location location entry for snmp
1848
1849 # Using state: replaced
1850
1851 # Before state:
1852 # -------------
1853
1854 # router-ios#show running-config | section ^snmp-server
1855 # snmp-server community communityOverriden RW acl_uq
1856 # snmp-server packetsize 500
1857 # snmp-server location location entry for snmp
1858
1859 # Replaced play:
1860 # --------------
1861
1862 - name: Replace commands with provided configuration
1863 cisco.ios.ios_snmp_server:
1864 config:
1865 location: "updated location entry"
1866 packet_size: 500
1867 communities:
1868 - acl_v4: acl_uq
1869 name: communityOverriden
1870 rw: true
1871 state: replaced
1872
1873 # Commands Fired:
1874 # ---------------
1875
1876 # "commands": [
1877 # "snmp-server location updated location entry"
1878 # ],
1879
1880 # After state:
1881 # ------------
1882
1883 # router-ios#show running-config | section ^snmp-server
1884 # snmp-server community communityOverriden RW acl_uq
1885 # snmp-server packetsize 500
1886 # snmp-server location updated location entry
1887
1888 # Using state: gathered
1889
1890 # Before state:
1891 # -------------
1892
1893 # router-ios#show running-config | section ^snmp-server
1894 # snmp-server engineID remote 172.16.0.12 udp-port 25 AB0C5342FF0F
1895 # snmp-server user userPaul dev v1 access 24
1896 # snmp-server group mergedGroup v3 auth
1897 # snmp-server community communityOvverriden RW acl_uq
1898 # snmp-server community mergedComm RW testACL
1899 # snmp-server packetsize 500
1900 # snmp-server location updated location entry
1901 # snmp-server contact contact updated using merged
1902 # snmp-server enable traps tty
1903 # snmp-server enable traps ospf state-change
1904 # snmp-server enable traps ospf errors
1905 # snmp-server enable traps ospf retransmit
1906 # snmp-server enable traps ospf lsa
1907 # snmp-server enable traps ospf cisco-specific state-change nssa-trans-change
1908 # snmp-server enable traps ospf cisco-specific state-change shamlink interface
1909 # snmp-server enable traps ospf cisco-specific state-change shamlink neighbor
1910 # snmp-server enable traps ospf cisco-specific errors
1911 # snmp-server enable traps ospf cisco-specific retransmit
1912 # snmp-server enable traps ospf cisco-specific lsa
1913 # snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency
1914 # snmp-server enable traps msdp
1915 # snmp-server enable traps syslog
1916 # snmp-server host 172.16.2.9 informs version 2c mergedComm msdp stun pki
1917 # snmp-server host 172.16.2.9 mergedComm slb pki
1918 # snmp-server file-transfer access-group test protocol ftp
1919 # snmp-server password-policy MergedPolicy define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3
1920 # snmp-server password-policy MergedPolicy2 define min-len 12 upper-case 12 special-char 22 change 43
1921 # snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11
1922
1923 # Gathered play:
1924 # --------------
1925
1926 - name: Gather listed snmp config
1927 cisco.ios.ios_snmp_server:
1928 state: gathered
1929
1930 # Module Execution Result:
1931 # ------------------------
1932
1933 # "gathered": {
1934 # "communities": [
1935 # {
1936 # "acl_v4": "acl_uq",
1937 # "name": "communityOvverriden",
1938 # "rw": true
1939 # },
1940 # {
1941 # "acl_v4": "testACL",
1942 # "name": "mergedComm",
1943 # "rw": true
1944 # }
1945 # ],
1946 # "contact": "contact updated using merged",
1947 # "engine_id": [
1948 # {
1949 # "id": "AB0C5342FF0F",
1950 # "remote": {
1951 # "host": "172.16.0.12",
1952 # "udp_port": 25
1953 # }
1954 # }
1955 # ],
1956 # "file_transfer": {
1957 # "access_group": "test",
1958 # "protocol": [
1959 # "ftp"
1960 # ]
1961 # },
1962 # "groups": [
1963 # {
1964 # "group": "mergedGroup",
1965 # "version": "v3",
1966 # "version_option": "auth"
1967 # }
1968 # ],
1969 # "hosts": [
1970 # {
1971 # "community_string": "mergedComm",
1972 # "host": "172.16.2.9",
1973 # "informs": true,
1974 # "traps": [
1975 # "msdp",
1976 # "stun",
1977 # "pki"
1978 # ],
1979 # "version": "2c"
1980 # },
1981 # {
1982 # "community_string": "mergedComm",
1983 # "host": "172.16.2.9",
1984 # "traps": [
1985 # "slb",
1986 # "pki"
1987 # ]
1988 # }
1989 # ],
1990 # "location": "updated location entry",
1991 # "packet_size": 500,
1992 # "password_policy": [
1993 # {
1994 # "change": 3,
1995 # "digits": 23,
1996 # "lower_case": 12,
1997 # "max_len": 24,
1998 # "policy_name": "MergedPolicy",
1999 # "special_char": 32,
2000 # "upper_case": 12
2001 # },
2002 # {
2003 # "change": 43,
2004 # "min_len": 12,
2005 # "policy_name": "MergedPolicy2",
2006 # "special_char": 22,
2007 # "upper_case": 12
2008 # },
2009 # {
2010 # "change": 11,
2011 # "digits": 23,
2012 # "max_len": 12,
2013 # "min_len": 12,
2014 # "policy_name": "policy3",
2015 # "special_char": 22,
2016 # "upper_case": 12
2017 # }
2018 # ],
2019 # "traps": {
2020 # "cef": {
2021 # "enable": true,
2022 # "inconsistency": true,
2023 # "peer_fib_state_change": true,
2024 # "peer_state_change": true,
2025 # "resource_failure": true
2026 # },
2027 # "msdp": true,
2028 # "ospf": {
2029 # "cisco_specific": {
2030 # "error": true,
2031 # "lsa": true,
2032 # "retransmit": true,
2033 # "state_change": {
2034 # "nssa_trans_change": true,
2035 # "shamlink": {
2036 # "interface": true,
2037 # "neighbor": true
2038 # }
2039 # }
2040 # },
2041 # "error": true,
2042 # "lsa": true,
2043 # "retransmit": true,
2044 # "state_change": true
2045 # },
2046 # "syslog": true,
2047 # "tty": true
2048 # },
2049 # "users": [
2050 # {
2051 # "acl_v4": "24",
2052 # "group": "dev",
2053 # "username": "userPaul",
2054 # "version": "v1"
2055 # }
2056 # ]
2057 # },
2058
2059 # Using state: rendered
2060
2061 # Rendered play:
2062 # --------------
2063
2064 - name: Render the commands for provided configuration
2065 cisco.ios.ios_snmp_server:
2066 config:
2067 accounting:
2068 command: default
2069 cache: 2
2070 chassis_id: entry for chassis id
2071 communities:
2072 - acl_v6: te
2073 name: test
2074 ro: true
2075 view: terst1
2076 - acl_v4: "1322"
2077 name: wete
2078 ro: true
2079 - acl_v4: paul
2080 name: weteww
2081 rw: true
2082 contact: details contact
2083 context:
2084 - contextA
2085 - contextB
2086 engine_id:
2087 - id: AB0C5342FA0A
2088 local: true
2089 - id: AB0C5342FAAB
2090 remote:
2091 host: 172.16.0.2
2092 udp_port: 23
2093 - id: AB0C5342FAAA
2094 remote:
2095 host: 172.16.0.1
2096 udp_port: 22
2097 file_transfer:
2098 access_group: testAcl
2099 protocol:
2100 - ftp
2101 - rcp
2102 groups:
2103 - group: grpFamily
2104 version: v3
2105 version_option: auth
2106 - context: mycontext
2107 group: grpFamily
2108 version: v1
2109 - acl_v4: "2"
2110 group: grp1
2111 notify: me
2112 version: v1
2113 - group: newtera
2114 version: v3
2115 version_option: priv
2116 - group: relaplacing
2117 version: v3
2118 version_option: noauth
2119 hosts:
2120 - community_string: check
2121 host: 172.16.2.99
2122 informs: true
2123 traps:
2124 - msdp
2125 - stun
2126 version: 2c
2127 - community_string: check
2128 host: 172.16.2.99
2129 traps:
2130 - slb
2131 - pki
2132 - community_string: checktrap
2133 host: 172.16.2.99
2134 traps:
2135 - isis
2136 - hsrp
2137 - community_string: newtera
2138 host: 172.16.2.1
2139 traps:
2140 - rsrb
2141 - pim
2142 - rsvp
2143 - slb
2144 - pki
2145 version: "3"
2146 version_option: priv
2147 - community_string: relaplacing
2148 host: 172.16.2.1
2149 traps:
2150 - slb
2151 - pki
2152 version: "3"
2153 version_option: noauth
2154 - community_string: trapsac
2155 host: 172.16.2.1
2156 traps:
2157 - tty
2158 - bgp
2159 version: 2c
2160 - community_string: www
2161 host: 172.16.1.1
2162 traps:
2163 - tty
2164 - bgp
2165 version: "3"
2166 version_option: auth
2167 inform:
2168 pending: 2
2169 ip:
2170 dscp: 2
2171 location: "entry for snmp location"
2172 packet_size: 500
2173 password_policy:
2174 - change: 3
2175 digits: 23
2176 lower_case: 12
2177 max_len: 24
2178 policy_name: policy1
2179 special_char: 32
2180 upper_case: 12
2181 - change: 9
2182 min_len: 12
2183 policy_name: policy2
2184 special_char: 22
2185 upper_case: 12
2186 - change: 11
2187 digits: 23
2188 max_len: 12
2189 min_len: 12
2190 policy_name: policy3
2191 special_char: 22
2192 upper_case: 12
2193 queue_length: 2
2194 source_interface: Loopback999
2195 system_shutdown: true
2196 trap_source: GigabitEthernet0/0
2197 trap_timeout: 2
2198 traps:
2199 auth_framework:
2200 enable: true
2201 bgp:
2202 cbgp2: true
2203 enable: true
2204 bfd:
2205 enable: true
2206 session_down: true
2207 session_up: true
2208 bridge:
2209 enable: true
2210 newroot: true
2211 topologychange: true
2212 casa: true
2213 cef:
2214 enable: true
2215 inconsistency: true
2216 peer_fib_state_change: true
2217 peer_state_change: true
2218 resource_failure: true
2219 dlsw:
2220 enable: true
2221 eigrp: true
2222 ethernet:
2223 cfm:
2224 alarm: true
2225 evc:
2226 status: true
2227 event_manager: true
2228 flowmon: true
2229 frame_relay:
2230 enable: true
2231 subif:
2232 enable: true
2233 hsrp: true
2234 ike:
2235 policy:
2236 add: true
2237 delete: true
2238 tunnel:
2239 start: true
2240 stop: true
2241 ipmulticast: true
2242 ipsec:
2243 cryptomap:
2244 add: true
2245 attach: true
2246 delete: true
2247 detach: true
2248 too_many_sas: true
2249 tunnel:
2250 start: true
2251 stop: true
2252 ipsla: true
2253 l2tun:
2254 pseudowire_status: true
2255 session: true
2256 msdp: true
2257 ospf:
2258 cisco_specific:
2259 error: true
2260 lsa: true
2261 retransmit: true
2262 state_change:
2263 nssa_trans_change: true
2264 shamlink:
2265 interface: true
2266 neighbor: true
2267 error: true
2268 lsa: true
2269 retransmit: true
2270 state_change: true
2271 pim:
2272 enable: true
2273 invalid_pim_message: true
2274 neighbor_change: true
2275 rp_mapping_change: true
2276 pki: true
2277 rsvp: true
2278 snmp:
2279 authentication: true
2280 coldstart: true
2281 linkdown: true
2282 linkup: true
2283 warmstart: true
2284 syslog: true
2285 tty: true
2286 users:
2287 - acl_v4: "24"
2288 group: groupFamily
2289 username: paul
2290 version: v1
2291 - acl_v4: ipv6
2292 group: groupFamily
2293 username: domnic
2294 version: v3
2295 - group: relaplacing
2296 username: relaplacing
2297 version: v3
2298 state: rendered
2299
2300 # Module Execution Result:
2301 # ------------------------
2302
2303 # "rendered": [
2304 # "snmp-server accounting commands default",
2305 # "snmp-server cache interval 2",
2306 # "snmp-server chassis-id entry for chassis id",
2307 # "snmp-server contact details contact",
2308 # "snmp-server file-transfer access-group testAcl protocol ftp rcp",
2309 # "snmp-server inform pending 2",
2310 # "snmp-server ip dscp 2",
2311 # "snmp-server location entry for snmp location",
2312 # "snmp-server packetsize 500",
2313 # "snmp-server queue-length 2",
2314 # "snmp-server trap timeout 2",
2315 # "snmp-server source-interface informs Loopback999",
2316 # "snmp-server trap-source GigabitEthernet0/0",
2317 # "snmp-server system-shutdown",
2318 # "snmp-server enable traps auth-framework",
2319 # "snmp-server enable traps bfd session-down session-up",
2320 # "snmp-server enable traps bgp cbgp2",
2321 # "snmp-server enable traps bridge newroot topologychange",
2322 # "snmp-server enable traps casa",
2323 # "snmp-server enable traps eigrp",
2324 # "snmp-server enable traps event-manager",
2325 # "snmp-server enable traps flowmon",
2326 # "snmp-server enable traps hsrp",
2327 # "snmp-server enable traps ipsla",
2328 # "snmp-server enable traps msdp",
2329 # "snmp-server enable traps pki",
2330 # "snmp-server enable traps rsvp",
2331 # "snmp-server enable traps syslog",
2332 # "snmp-server enable traps tty",
2333 # "snmp-server enable traps ipmulticast",
2334 # "snmp-server enable traps ike policy add",
2335 # "snmp-server enable traps ike policy delete",
2336 # "snmp-server enable traps ike tunnel start",
2337 # "snmp-server enable traps ike tunnel stop",
2338 # "snmp-server enable traps ipsec cryptomap add",
2339 # "snmp-server enable traps ipsec cryptomap delete",
2340 # "snmp-server enable traps ipsec cryptomap attach",
2341 # "snmp-server enable traps ipsec cryptomap detach",
2342 # "snmp-server enable traps ipsec tunnel start",
2343 # "snmp-server enable traps ipsec tunnel stop",
2344 # "snmp-server enable traps ipsec too-many-sas",
2345 # "snmp-server enable traps ospf cisco-specific errors",
2346 # "snmp-server enable traps ospf cisco-specific retransmit",
2347 # "snmp-server enable traps ospf cisco-specific lsa",
2348 # "snmp-server enable traps ospf cisco-specific state-change nssa-trans-change",
2349 # "snmp-server enable traps ospf cisco-specific state-change shamlink interface",
2350 # "snmp-server enable traps ospf cisco-specific state-change shamlink neighbor",
2351 # "snmp-server enable traps ospf errors",
2352 # "snmp-server enable traps ospf retransmit",
2353 # "snmp-server enable traps ospf lsa",
2354 # "snmp-server enable traps ospf state-change",
2355 # "snmp-server enable traps l2tun pseudowire status",
2356 # "snmp-server enable traps l2tun session",
2357 # "snmp-server enable traps pim neighbor-change rp-mapping-change invalid-pim-message",
2358 # "snmp-server enable traps snmp authentication linkdown linkup warmstart coldstart",
2359 # "snmp-server enable traps frame-relay",
2360 # "snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency",
2361 # "snmp-server enable traps dlsw",
2362 # "snmp-server enable traps ethernet evc status",
2363 # "snmp-server enable traps ethernet cfm alarm",
2364 # "snmp-server host 172.16.2.99 informs version 2c check msdp stun",
2365 # "snmp-server host 172.16.2.99 check slb pki",
2366 # "snmp-server host 172.16.2.99 checktrap isis hsrp",
2367 # "snmp-server host 172.16.2.1 version 3 priv newtera rsrb pim rsvp slb pki",
2368 # "snmp-server host 172.16.2.1 version 3 noauth relaplacing slb pki",
2369 # "snmp-server host 172.16.2.1 version 2c trapsac tty bgp",
2370 # "snmp-server host 172.16.1.1 version 3 auth www tty bgp",
2371 # "snmp-server group grpFamily v1 context mycontext",
2372 # "snmp-server group grp1 v1 notify me access 2",
2373 # "snmp-server group newtera v3 priv",
2374 # "snmp-server group relaplacing v3 noauth",
2375 # "snmp-server engineID local AB0C5342FA0A",
2376 # "snmp-server engineID remote 172.16.0.2 udp-port 23 AB0C5342FAAB",
2377 # "snmp-server engineID remote 172.16.0.1 udp-port 22 AB0C5342FAAA",
2378 # "snmp-server community test view terst1 ro ipv6 te",
2379 # "snmp-server community wete ro 1322",
2380 # "snmp-server community weteww rw paul",
2381 # "snmp-server context contextA",
2382 # "snmp-server context contextB",
2383 # "snmp-server password-policy policy1 define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3",
2384 # "snmp-server password-policy policy2 define min-len 12 upper-case 12 special-char 22 change 9",
2385 # "snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11",
2386 # "snmp-server user paul groupFamily v1 access 24",
2387 # "snmp-server user domnic groupFamily v3 access ipv6",
2388 # "snmp-server user relaplacing relaplacing v3"
2389 # ]
2390
2391 # Using state: parsed
2392
2393 # File: parsed.cfg
2394 # ----------------
2395
2396 # snmp-server engineID local AB0C5342FA0A
2397 # snmp-server engineID remote 172.16.0.2 udp-port 23 AB0C5342FAAB
2398 # snmp-server engineID remote 172.16.0.1 udp-port 22 AB0C5342FAAA
2399 # snmp-server user newuser newfamily v1 access 24
2400 # snmp-server user paul familypaul v3 access ipv6 ipv6acl
2401 # snmp-server user replaceUser replaceUser v3
2402 # snmp-server group group0 v3 auth
2403 # snmp-server group group1 v1 notify me access 2
2404 # snmp-server group group2 v3 priv
2405 # snmp-server group replaceUser v3 noauth
2406 # snmp-server community commu1 view view1 RO ipv6 te
2407 # snmp-server community commu2 RO 1322
2408 # snmp-server community commu3 RW paul
2409 # snmp-server trap timeout 2
2410 # snmp-server trap-source GigabitEthernet0/0
2411 # snmp-server source-interface informs Loopback999
2412 # snmp-server packetsize 500
2413 # snmp-server enable traps vrfmib vrf-up vrf-down vnet-trunk-up vnet-trunk-down
2414 # snmp-server host 172.16.2.99 informs version 2c check msdp stun
2415 # snmp-server host 172.16.2.1 version 2c trapsac tty bgp
2416 # snmp-server host 172.16.1.1 version 3 auth group0 tty bgp
2417 # snmp-server context contextWord1
2418 # snmp-server context contextWord2
2419 # snmp-server file-transfer access-group testAcl protocol ftp
2420 # snmp-server file-transfer access-group testAcl protocol rcp
2421 # snmp-server cache interval 2
2422 # snmp-server password-policy policy2 define min-len 12 upper-case 12 special-char 22 change 9
2423 # snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11
2424 # snmp-server accounting commands default
2425 # snmp-server inform pending 2
2426
2427 # Parsed play:
2428 # ------------
2429
2430 - name: Parse the provided configuration with the existing running configuration
2431 cisco.ios.ios_snmp_server:
2432 running_config: "{{ lookup('file', 'parsed.cfg') }}"
2433 state: parsed
2434
2435 # Module Execution Result:
2436 # ------------------------
2437 #
2438 # "parsed": {
2439 # "accounting": {
2440 # "command": "default"
2441 # },
2442 # "cache": 2,
2443 # "communities": [
2444 # {
2445 # "acl_v6": "te",
2446 # "name": "commu1",
2447 # "ro": true,
2448 # "view": "view1"
2449 # },
2450 # {
2451 # "acl_v4": "1322",
2452 # "name": "commu2",
2453 # "ro": true
2454 # },
2455 # {
2456 # "acl_v4": "paul",
2457 # "name": "commu3",
2458 # "rw": true
2459 # }
2460 # ],
2461 # "context": [
2462 # "contextWord1",
2463 # "contextWord2"
2464 # ],
2465 # "engine_id": [
2466 # {
2467 # "id": "AB0C5342FA0A",
2468 # "local": true
2469 # },
2470 # {
2471 # "id": "AB0C5342FAAA",
2472 # "remote": {
2473 # "host": "172.16.0.1",
2474 # "udp_port": 22
2475 # }
2476 # },
2477 # {
2478 # "id": "AB0C5342FAAB",
2479 # "remote": {
2480 # "host": "172.16.0.2",
2481 # "udp_port": 23
2482 # }
2483 # }
2484 # ],
2485 # "file_transfer": {
2486 # "access_group": "testAcl",
2487 # "protocol": [
2488 # "rcp",
2489 # "ftp"
2490 # ]
2491 # },
2492 # "groups": [
2493 # {
2494 # "group": "group0",
2495 # "version": "v3",
2496 # "version_option": "auth"
2497 # },
2498 # {
2499 # "acl_v4": "2",
2500 # "group": "group1",
2501 # "notify": "me",
2502 # "version": "v1"
2503 # },
2504 # {
2505 # "group": "group2",
2506 # "version": "v3",
2507 # "version_option": "priv"
2508 # },
2509 # {
2510 # "group": "replaceUser",
2511 # "version": "v3",
2512 # "version_option": "noauth"
2513 # }
2514 # ],
2515 # "hosts": [
2516 # {
2517 # "community_string": "group0",
2518 # "host": "172.16.1.1",
2519 # "traps": [
2520 # "tty",
2521 # "bgp"
2522 # ],
2523 # "version": "3",
2524 # "version_option": "auth"
2525 # },
2526 # {
2527 # "community_string": "trapsac",
2528 # "host": "172.16.2.1",
2529 # "traps": [
2530 # "tty",
2531 # "bgp"
2532 # ],
2533 # "version": "2c"
2534 # },
2535 # {
2536 # "community_string": "check",
2537 # "host": "172.16.2.99",
2538 # "informs": true,
2539 # "traps": [
2540 # "msdp",
2541 # "stun"
2542 # ],
2543 # "version": "2c"
2544 # }
2545 # ],
2546 # "inform": {
2547 # "pending": 2
2548 # },
2549 # "packet_size": 500,
2550 # "password_policy": [
2551 # {
2552 # "change": 9,
2553 # "min_len": 12,
2554 # "policy_name": "policy2",
2555 # "special_char": 22,
2556 # "upper_case": 12
2557 # },
2558 # {
2559 # "change": 11,
2560 # "digits": 23,
2561 # "max_len": 12,
2562 # "min_len": 12,
2563 # "policy_name": "policy3",
2564 # "special_char": 22,
2565 # "upper_case": 12
2566 # }
2567 # ],
2568 # "source_interface": "Loopback999",
2569 # "trap_source": "GigabitEthernet0/0",
2570 # "trap_timeout": 2,
2571 # "traps": {
2572 # "vrfmib": {
2573 # "vnet_trunk_down": true,
2574 # "vnet_trunk_up": true,
2575 # "vrf_down": true,
2576 # "vrf_up": true
2577 # }
2578 # },
2579 # "users": [
2580 # {
2581 # "acl_v4": "24",
2582 # "group": "newfamily",
2583 # "username": "newuser",
2584 # "version": "v1"
2585 # },
2586 # {
2587 # "acl_v4": "ipv6",
2588 # "group": "familypaul",
2589 # "username": "paul",
2590 # "version": "v3"
2591 # },
2592 # {
2593 # "group": "replaceUser",
2594 # "username": "replaceUser",
2595 # "version": "v3"
2596 # }
2597 # ]
2598 # }
2599 """
2600
2601 RETURN = """
2602 before:
2603 description: The configuration prior to the module execution.
2604 returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged)
2605 type: dict
2606 sample: >
2607 This output will always be in the same format as the
2608 module argspec.
2609 after:
2610 description: The resulting configuration after module execution.
2611 returned: when changed
2612 type: dict
2613 sample: >
2614 This output will always be in the same format as the
2615 module argspec.
2616 commands:
2617 description: The set of commands pushed to the remote device.
2618 returned: when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged)
2619 type: list
2620 sample:
2621 - snmp-server host 172.16.2.99 informs version 2c check msdp stun
2622 - snmp-server engineID remote 172.16.0.2 udp-port 23 AB0C5342FAAB
2623 - snmp-server group grp1 v1 notify me access 2
2624 rendered:
2625 description: The provided configuration in the task rendered in device-native format (offline).
2626 returned: when I(state) is C(rendered)
2627 type: list
2628 sample:
2629 - snmp-server enable traps ipsec cryptomap attach
2630 - snmp-server password-policy policy1 define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3
2631 - snmp-server cache interval 2
2632 gathered:
2633 description: Facts about the network resource gathered from the remote device as structured data.
2634 returned: when I(state) is C(gathered)
2635 type: list
2636 sample: >
2637 This output will always be in the same format as the
2638 module argspec.
2639 parsed:
2640 description: The device native config provided in I(running_config) option parsed into structured data as per module argspec.
2641 returned: when I(state) is C(parsed)
2642 type: list
2643 sample: >
2644 This output will always be in the same format as the
2645 module argspec.
2646 """
2647
2648 from ansible.module_utils.basic import AnsibleModule
2649
2650 from ansible_collections.cisco.ios.plugins.module_utils.network.ios.argspec.snmp_server.snmp_server import (
2651 Snmp_serverArgs,
2652 )
2653 from ansible_collections.cisco.ios.plugins.module_utils.network.ios.config.snmp_server.snmp_server import (
2654 Snmp_server,
2655 )
2656
2657
2658 def main():
2659 """
2660 Main entry point for module execution
2661
2662 :returns: the result form module invocation
2663 """
2664 module = AnsibleModule(
2665 argument_spec=Snmp_serverArgs.argument_spec,
2666 mutually_exclusive=[["config", "running_config"]],
2667 required_if=[
2668 ["state", "merged", ["config"]],
2669 ["state", "replaced", ["config"]],
2670 ["state", "overridden", ["config"]],
2671 ["state", "rendered", ["config"]],
2672 ["state", "parsed", ["running_config"]],
2673 ],
2674 supports_check_mode=True,
2675 )
2676
2677 result = Snmp_server(module).execute_module()
2678 module.exit_json(**result)
2679
2680
2681 if __name__ == "__main__":
2682 main()