cisco.ios.ios_snmp_server module – Resource module to configure snmp server.
Note
This module is part of the cisco.ios collection (version 2.8.1).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install cisco.ios
.
To use it in a playbook, specify: cisco.ios.ios_snmp_server
.
New in version 2.6.0: of cisco.ios
Parameters
Parameter |
Comments |
---|---|
A dictionary of SNMP server configuration |
|
SNMP Accounting parameters |
|
For SNMP set commands |
|
Enable SNMP cache and MIB expiry interval |
|
String to uniquely identify this chassis (Hexadecimal) |
|
Community name configuration. |
|
standard access-list name |
|
IPv6 access list name |
|
Community name (default RO) |
|
Only reads are permitted Choices:
|
|
Read-write access Choices:
|
|
MIB view name |
|
Text for mib object sysContact |
|
Create/Delete a context apart from default |
|
Silently drop SNMP packets |
|
Silently drop unknown v3 user packets Choices:
|
|
Silently drop SNMP packets that come on VRF interfaces Choices:
|
|
Configure a local or remote SNMPv3 engineID |
|
engine ID octet string |
|
Local SNMP agent Choices:
|
|
Remote SNMP agent |
|
Hostname or IP address of remote SNMP notification host |
|
The remote SNMP notification host’s UDP port number. |
|
The remote notification host’s VPN routing instance |
|
File transfer related commands |
|
Access control for file transfers |
|
Access control protocol for file transfers |
|
Define a User Security Model group |
|
specify an access-list associated with this group |
|
specify an access-list associated with this group |
|
Specify a context to associate with the group |
|
SNMP group for the user |
|
View to restrict notifications |
|
View to restrict read access |
|
snmp security group version Choices:
|
|
community name to the host. Choices:
|
|
View to restrict write access |
|
Specify hosts to receive SNMP notifications |
|
SNMPv1/v2c community string or SNMPv3 user name |
|
Hostname or IP address of SNMP notification host. |
|
Use SNMP inform messages. Choices:
|
|
Use SNMP trap messages |
|
Notification message SNMP version. Choices:
|
|
community name to the host. Choices:
|
|
Specify the VRF in which the host is configured |
|
Enable ifindex persistence Choices:
|
|
Configure SNMP Informs options |
|
Set number of unacked informs to hold |
|
Set retry count for informs |
|
Set timeout for informs |
|
IP ToS configuration for SNMP traffic |
|
IP DSCP value for SNMP traffic |
|
IP Precedence value for SNMP traffic |
|
Text for mib object sysLocation |
|
Modify SNMP manager parameters |
|
Largest SNMP packet size |
|
SNMP v3 users password policy |
|
Number of Character changes b/w old and new password |
|
Number of digits |
|
Number of lower-case characters |
|
Maximum password length |
|
Minimum password length |
|
Name of the policy |
|
Number of special case character |
|
Number of upper-case characters |
|
Name of the user |
|
Message queue length for each TRAP host |
|
Source interface to be used for sending out SNMP notifications. |
|
Enable use of the SNMP reload command Choices:
|
|
Assign an interface for the source address of all traps |
|
Set timeout for TRAP message retransmissions |
|
Enable SNMP Traps |
|
Enable SNMP CISCO-AUTH-FRAMEWORK-MIB traps |
|
Enable/disable auth framework Choices:
|
|
Mode sec_violation Choices:
|
|
Allow SNMP BFD traps |
|
Enable/disable bfd Choices:
|
|
Enable BFD session down traps Choices:
|
|
Enable BFD session up traps Choices:
|
|
Allow bgp traps |
|
Enable BGP MIBv2 traps Choices:
|
|
Enable/disable bgp traps Choices:
|
|
Traps for FSM state changes |
|
CISCO specific trap for all fsm state changes Choices:
|
|
CISCO specific trap for backward transition Choices:
|
|
Enable/disable bgp state_changes traps Choices:
|
|
Trap for standard backward transition and established Choices:
|
|
Mode threshold |
|
Enable/disable bgp threshold traps Choices:
|
|
Allow bridge related traps |
|
Enable/disable bridge traps Choices:
|
|
Enable SNMP STP Bridge MIB newroot traps Choices:
|
|
Enable SNMP STP Bridge MIB topologychange traps Choices:
|
|
Enable SNMP config casa traps Choices:
|
|
Allow cef related traps |
|
Enable/disable cef traps Choices:
|
|
Enable SNMP CEF Inconsistency traps Choices:
|
|
Enable SNMP CEF Peer FIB State change traps Choices:
|
|
Enable SNMP CEF Peer state change traps Choices:
|
|
Enable SNMP CEF Resource Failure traps Choices:
|
|
Enable SNMP cnpd traps Choices:
|
|
Enable SNMP config traps Choices:
|
|
Enable SNMP config copy traps Choices:
|
|
Enable SNMP config ctid traps Choices:
|
|
Allow CPU related traps |
|
Enable/disable cpu traps Choices:
|
|
Mode threshold Choices:
|
|
Enable SNMP dhcp traps Choices:
|
|
Allow dlsw related traps |
|
Enable SNMP dlsw circuit traps Choices:
|
|
Enable/disable cef traps Choices:
|
|
Enable SNMP dlsw peer transport connection traps Choices:
|
|
Enable SNMP eigrp traps Choices:
|
|
Enable SNMP energywise traps Choices:
|
|
Enable SNMP entity traps Choices:
|
|
Allow ethernet traps |
|
Enable SNMP Ethernet CFM traps |
|
Enable SNMP Ethernet CFM fault alarm trap Choices:
|
|
Enable SNMP Ethernet CC trap |
|
Enable SNMP Ethernet CFM configuration error traps Choices:
|
|
Enable SNMP Ethernet CFM cross-connect traps Choices:
|
|
Enable SNMP Ethernet CFM loop traps Choices:
|
|
Enable SNMP Ethernet CFM CC Down traps Choices:
|
|
Enable SNMP Ethernet CFM CC Up traps Choices:
|
|
Enable SNMP Ethernet CC crosscheck trap |
|
Enable SNMP Ethernet CC crosscheck missing trap Choices:
|
|
Enable SNMP Ethernet CC crosscheck unknown traps Choices:
|
|
Enable SNMP Ethernet CC crosscheck service traps Choices:
|
|
Enable SNMP Ethernet EVC traps |
|
Enable SNMP Ethernet EVC create traps Choices:
|
|
Enable SNMP Ethernet EVC delete traps Choices:
|
|
Enable SNMP Ethernet EVC status traps Choices:
|
|
Enable SNMP event-manager traps Choices:
|
|
Enable SNMP firewall traps |
|
Enable/disable firewall traps Choices:
|
|
Enable firewall server status change trap Choices:
|
|
Enable SNMP flowmon traps Choices:
|
|
Allow frame-relay traps |
|
Enable/disable frame-relay traps Choices:
|
|
Enable SNMP frame-relay subinterface traps |
|
Maximum number of traps sent per interval |
|
Enable/disable subif traps Choices:
|
|
Interval duration in which to limit the number of traps sent |
|
Enable SNMP fru-ctrl traps Choices:
|
|
Enable SNMP hsrp traps Choices:
|
|
Allow ike traps |
|
Enable IKE Policy traps |
|
Enable IKE Policy add trap Choices:
|
|
Enable IKE Policy delete trap Choices:
|
|
Enable IKE Tunnel traps |
|
Enable IKE Tunnel start trap Choices:
|
|
Enable IKE Tunnel stop trap Choices:
|
|
Enable SNMP ip multi cast traps Choices:
|
|
Allow ike traps |
|
Enable IPsec Cryptomap traps |
|
Enable IPsec Cryptomap add trap Choices:
|
|
Enable IPsec Cryptomap Attach trap Choices:
|
|
Enable IPsec Cryptomap delete trap Choices:
|
|
Enable IPsec Cryptomap Detach trap Choices:
|
|
Enable IPsec Tunnel Start trap Choices:
|
|
Enable IPsec Tunnel traps |
|
Enable IPsec Tunnel start trap Choices:
|
|
Enable IPsec Tunnel stop trap Choices:
|
|
Enable SNMP ipsla traps Choices:
|
|
Enable SNMP isis traps Choices:
|
|
Allow SNMP l2tun traps |
|
Enable BFD pseudo wire status traps Choices:
|
|
Enable BFD session traps Choices:
|
|
Enable SNMP mpls traps Choices:
|
|
Enable SNMP msdp traps Choices:
|
|
Enable SNMP mvpn traps Choices:
|
|
Allow ospf related traps |
|
Cisco specific traps |
|
error traps Choices:
|
|
Lsa related traps Choices:
|
|
Packet retransmit traps Choices:
|
|
state change traps |
|
Nssa translator state changes Choices:
|
|
Config mismatch errors on virtual interfaces |
|
Sham link interface state changes Choices:
|
|
Sham link neighbor state changes Choices:
|
|
Enable error traps Choices:
|
|
Enable/disable ospf lsa traps Choices:
|
|
Enable/disable ospf retransmit traps Choices:
|
|
Enable/disable state change traps Choices:
|
|
Allow PIM traps |
|
Enable/disable PIM traps Choices:
|
|
Enable invalid pim message trap Choices:
|
|
Enable neighbor change trap Choices:
|
|
Enable rp mapping change trap Choices:
|
|
Enable SNMP pki traps Choices:
|
|
Enable SNMP pw vc traps Choices:
|
|
Enable SNMP RSVP traps Choices:
|
|
Enable SNMP traps |
|
Enable authentication trap Choices:
|
|
Enable coldStart trap Choices:
|
|
Enable linkDown trap Choices:
|
|
Enable linkUp trap Choices:
|
|
Enable warmStart trap Choices:
|
|
Enable SNMP syslog traps Choices:
|
|
Enable SNMP transceiver traps Choices:
|
|
Enable SNMP tty TCP connection traps Choices:
|
|
Allow vrfmib traps |
|
Enable vnet-trunk-down traps Choices:
|
|
Enable vnet-trunk-up trap Choices:
|
|
Enable vrf-down trap Choices:
|
|
Enable vrf-up trap Choices:
|
|
Enable SNMP vrrp traps Choices:
|
|
Define a user who can access the SNMP engine |
|
Access list ipv4 associated |
|
Access list ipv6 associated |
|
Authentication parameters for the user. Effects idempotency of module as configuration applied is not reflected in running-config. |
|
Select algorithm for authentication. Choices:
|
|
Authentication password for user. |
|
Encryption parameters for the user. Effects idempotency of module as configuration applied is not reflected in running-config. |
|
Authentication password for user. |
|
Select algorithm for encryption. Choices:
|
|
Add extra option for specific priv if any. |
|
SNMP group for the user. |
|
System where an SNMPv3 user is hosted |
|
UDP port used by the remote SNMP system |
|
SNMP user name |
|
SNMP security version Choices:
|
|
Enable encrypted version option. Choices:
|
|
The remote SNMP entity’s VPN Routing instance |
|
Define an SNMPv2 MIB view |
|
MIB family is excluded from the view Choices:
|
|
MIB view family name |
|
MIB family is included in the view Choices:
|
|
Name of the view |
|
This option is used only with state parsed. The value of this option should be the output received from the IOS device by executing the command show running-config | include snmp-server. The state parsed reads the configuration from |
|
The state the configuration should be left in. Refer to examples for more details. The states replaced and overridden have identical behaviour for this module. Choices:
|
Examples
# Using state: merged
# Before state:
# -------------
# router-ios#show running-config | section ^snmp-server
# --------------------- EMPTY -----------------
# Merged play:
# ------------
- name: Apply the provided configuration
cisco.ios.ios_snmp_server:
config:
communities:
- acl_v4: testACL
name: mergedComm
rw: true
contact: contact updated using merged
engine_id:
- id: AB0C5342FF0F
remote:
host: 172.16.0.12
udp_port: 25
groups:
- group: mergedGroup
version: v3
version_option: auth
file_transfer:
access_group: test
protocol:
- ftp
hosts:
- community_string: mergedComm
host: 172.16.2.9
informs: true
traps:
- msdp
- stun
- pki
version: 2c
- community_string: mergedComm
host: 172.16.2.9
traps:
- slb
- pki
password_policy:
- change: 3
digits: 23
lower_case: 12
max_len: 24
policy_name: MergedPolicy
special_char: 32
upper_case: 12
- change: 43
min_len: 12
policy_name: MergedPolicy2
special_char: 22
upper_case: 12
- change: 11
digits: 23
max_len: 12
min_len: 12
policy_name: policy3
special_char: 22
upper_case: 12
traps:
cef:
enable: true
inconsistency: true
peer_fib_state_change: true
peer_state_change: true
resource_failure: true
msdp: true
ospf:
cisco_specific:
error: true
lsa: true
retransmit: true
state_change:
nssa_trans_change: true
shamlink:
interface: true
neighbor: true
error: true
lsa: true
retransmit: true
state_change: true
syslog: true
tty: true
users:
- acl_v4: '24'
group: dev
username: userPaul
version: v1
state: merged
# Commands Fired:
# ---------------
# "commands": [
# "snmp-server contact contact updated using merged",
# "snmp-server file-transfer access-group test protocol ftp",
# "snmp-server enable traps msdp",
# "snmp-server enable traps syslog",
# "snmp-server enable traps tty",
# "snmp-server enable traps ospf cisco-specific errors",
# "snmp-server enable traps ospf cisco-specific retransmit",
# "snmp-server enable traps ospf cisco-specific lsa",
# "snmp-server enable traps ospf cisco-specific state-change nssa-trans-change",
# "snmp-server enable traps ospf cisco-specific state-change shamlink interface",
# "snmp-server enable traps ospf cisco-specific state-change shamlink neighbor",
# "snmp-server enable traps ospf errors",
# "snmp-server enable traps ospf retransmit",
# "snmp-server enable traps ospf lsa",
# "snmp-server enable traps ospf state-change",
# "snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency",
# "snmp-server host 172.16.2.9 informs version 2c mergedComm msdp stun pki",
# "snmp-server host 172.16.2.9 mergedComm slb pki",
# "snmp-server group mergedGroup v3 auth",
# "snmp-server engineID remote 172.16.0.12 udp-port 25 AB0C5342FF0F",
# "snmp-server community mergedComm rw testACL",
# "snmp-server password-policy MergedPolicy define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3",
# "snmp-server password-policy MergedPolicy2 define min-len 12 upper-case 12 special-char 22 change 43",
# "snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11",
# "snmp-server user userPaul dev v1 access 24"
# ],
# After state:
# ------------
# router-ios#show running-config | section ^snmp-server
# snmp-server engineID remote 172.16.0.12 udp-port 25 AB0C5342FF0F
# snmp-server user userPaul dev v1 access 24
# snmp-server group mergedGroup v3 auth
# snmp-server community mergedComm RW testACL
# snmp-server contact contact updated using merged
# snmp-server enable traps tty
# snmp-server enable traps ospf state-change
# snmp-server enable traps ospf errors
# snmp-server enable traps ospf retransmit
# snmp-server enable traps ospf lsa
# snmp-server enable traps ospf cisco-specific state-change nssa-trans-change
# snmp-server enable traps ospf cisco-specific state-change shamlink interface
# snmp-server enable traps ospf cisco-specific state-change shamlink neighbor
# snmp-server enable traps ospf cisco-specific errors
# snmp-server enable traps ospf cisco-specific retransmit
# snmp-server enable traps ospf cisco-specific lsa
# snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency
# snmp-server enable traps msdp
# snmp-server enable traps syslog
# snmp-server host 172.16.2.9 informs version 2c mergedComm msdp stun pki
# snmp-server host 172.16.2.9 mergedComm slb pki
# snmp-server file-transfer access-group test protocol ftp
# snmp-server password-policy MergedPolicy define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3
# snmp-server password-policy MergedPolicy2 define min-len 12 upper-case 12 special-char 22 change 43
# snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11
# Using state: deleted
# Before state:
# -------------
# router-ios#show running-config | section ^snmp-server
# snmp-server engineID remote 172.16.0.12 udp-port 25 AB0C5342FF0F
# snmp-server user userPaul dev v1 access 24
# snmp-server group mergedGroup v3 auth
# snmp-server community mergedComm RW testACL
# snmp-server contact contact updated using merged
# snmp-server enable traps tty
# snmp-server enable traps ospf state-change
# snmp-server enable traps ospf errors
# snmp-server enable traps ospf retransmit
# snmp-server enable traps ospf lsa
# snmp-server enable traps ospf cisco-specific state-change nssa-trans-change
# snmp-server enable traps ospf cisco-specific state-change shamlink interface
# snmp-server enable traps ospf cisco-specific state-change shamlink neighbor
# snmp-server enable traps ospf cisco-specific errors
# snmp-server enable traps ospf cisco-specific retransmit
# snmp-server enable traps ospf cisco-specific lsa
# snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency
# snmp-server enable traps msdp
# snmp-server enable traps syslog
# snmp-server host 172.16.2.9 informs version 2c mergedComm msdp stun pki
# snmp-server host 172.16.2.9 mergedComm slb pki
# snmp-server file-transfer access-group test protocol ftp
# snmp-server password-policy MergedPolicy define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3
# snmp-server password-policy MergedPolicy2 define min-len 12 upper-case 12 special-char 22 change 43
# snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11
# Deleted play:
# -------------
- name: Remove all existing configuration
cisco.ios.ios_snmp_server:
state: deleted
# Commands Fired:
# ---------------
# "commands": [
# "no snmp-server contact contact updated using merged",
# "no snmp-server file-transfer access-group test protocol ftp",
# "no snmp-server enable traps msdp",
# "no snmp-server enable traps syslog",
# "no snmp-server enable traps tty",
# "no snmp-server enable traps ospf cisco-specific errors",
# "no snmp-server enable traps ospf cisco-specific retransmit",
# "no snmp-server enable traps ospf cisco-specific lsa",
# "no snmp-server enable traps ospf cisco-specific state-change nssa-trans-change",
# "no snmp-server enable traps ospf cisco-specific state-change shamlink interface",
# "no snmp-server enable traps ospf cisco-specific state-change shamlink neighbor",
# "no snmp-server enable traps ospf errors",
# "no snmp-server enable traps ospf retransmit",
# "no snmp-server enable traps ospf lsa",
# "no snmp-server enable traps ospf state-change",
# "no snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency",
# "no snmp-server host 172.16.2.9 informs version 2c mergedComm msdp stun pki",
# "no snmp-server host 172.16.2.9 mergedComm slb pki",
# "no snmp-server group mergedGroup v3 auth",
# "no snmp-server engineID remote 172.16.0.12 udp-port 25 AB0C5342FF0F",
# "no snmp-server community mergedComm rw testACL",
# "no snmp-server password-policy MergedPolicy define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3",
# "no snmp-server password-policy MergedPolicy2 define min-len 12 upper-case 12 special-char 22 change 43",
# "no snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11",
# "no snmp-server user userPaul dev v1 access 24"
# ],
# After state:
# ------------
# router-ios#show running-config | section ^snmp-server
# --------------------- EMPTY -----------------
# Using state: overridden
# Before state:
# -------------
# router-ios#show running-config | section ^snmp-server
# snmp-server engineID remote 172.16.0.12 udp-port 25 AB0C5342FF0F
# snmp-server user userPaul dev v1 access 24
# snmp-server group mergedGroup v3 auth
# snmp-server community mergedComm RW testACL
# snmp-server contact contact updated using merged
# snmp-server enable traps tty
# snmp-server enable traps ospf state-change
# snmp-server enable traps ospf errors
# snmp-server enable traps ospf retransmit
# snmp-server enable traps ospf lsa
# snmp-server enable traps ospf cisco-specific state-change nssa-trans-change
# snmp-server enable traps ospf cisco-specific state-change shamlink interface
# snmp-server enable traps ospf cisco-specific state-change shamlink neighbor
# snmp-server enable traps ospf cisco-specific errors
# snmp-server enable traps ospf cisco-specific retransmit
# snmp-server enable traps ospf cisco-specific lsa
# snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency
# snmp-server enable traps msdp
# snmp-server enable traps syslog
# snmp-server host 172.16.2.9 informs version 2c mergedComm msdp stun pki
# snmp-server host 172.16.2.9 mergedComm slb pki
# snmp-server file-transfer access-group test protocol ftp
# snmp-server password-policy MergedPolicy define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3
# snmp-server password-policy MergedPolicy2 define min-len 12 upper-case 12 special-char 22 change 43
# snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11
# Overridden play:
# ----------------
- name: Override commands with provided configuration
cisco.ios.ios_snmp_server:
config:
location: 'location entry for snmp'
packet_size: 500
communities:
- acl_v4: acl_uq
name: communityOverriden
rw: true
state: overridden
# Commands Fired:
# ---------------
# "commands": [
# "no snmp-server contact contact updated using merged",
# "no snmp-server file-transfer access-group test protocol ftp",
# "snmp-server location location entry for snmp",
# "snmp-server packetsize 500",
# "no snmp-server enable traps msdp",
# "no snmp-server enable traps syslog",
# "no snmp-server enable traps tty",
# "no snmp-server enable traps ospf cisco-specific errors",
# "no snmp-server enable traps ospf cisco-specific retransmit",
# "no snmp-server enable traps ospf cisco-specific lsa",
# "no snmp-server enable traps ospf cisco-specific state-change nssa-trans-change",
# "no snmp-server enable traps ospf cisco-specific state-change shamlink interface",
# "no snmp-server enable traps ospf cisco-specific state-change shamlink neighbor",
# "no snmp-server enable traps ospf errors",
# "no snmp-server enable traps ospf retransmit",
# "no snmp-server enable traps ospf lsa",
# "no snmp-server enable traps ospf state-change",
# "no snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency",
# "no snmp-server host 172.16.2.9 informs version 2c mergedComm msdp stun pki",
# "no snmp-server host 172.16.2.9 mergedComm slb pki",
# "no snmp-server group mergedGroup v3 auth",
# "no snmp-server engineID remote 172.16.0.12 udp-port 25 AB0C5342FF0F",
# "snmp-server community communityOvverriden rw acl_uq",
# "no snmp-server community mergedComm rw testACL",
# "no snmp-server password-policy MergedPolicy define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3",
# "no snmp-server password-policy MergedPolicy2 define min-len 12 upper-case 12 special-char 22 change 43",
# "no snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11",
# "no snmp-server user userPaul dev v1 access 24"
# ],
# After state:
# ------------
# router-ios#show running-config | section ^snmp-server
# snmp-server community communityOverriden RW acl_uq
# snmp-server packetsize 500
# snmp-server location location entry for snmp
# Using state: replaced
# Before state:
# -------------
# router-ios#show running-config | section ^snmp-server
# snmp-server community communityOverriden RW acl_uq
# snmp-server packetsize 500
# snmp-server location location entry for snmp
# Replaced play:
# --------------
- name: Replace commands with provided configuration
cisco.ios.ios_snmp_server:
config:
location: 'updated location entry'
packet_size: 500
communities:
- acl_v4: acl_uq
name: communityOverriden
rw: true
state: replaced
# Commands Fired:
# ---------------
# "commands": [
# "snmp-server location updated location entry"
# ],
# After state:
# ------------
# router-ios#show running-config | section ^snmp-server
# snmp-server community communityOverriden RW acl_uq
# snmp-server packetsize 500
# snmp-server location updated location entry
# Using state: gathered
# Before state:
# -------------
#router-ios#show running-config | section ^snmp-server
# snmp-server engineID remote 172.16.0.12 udp-port 25 AB0C5342FF0F
# snmp-server user userPaul dev v1 access 24
# snmp-server group mergedGroup v3 auth
# snmp-server community communityOvverriden RW acl_uq
# snmp-server community mergedComm RW testACL
# snmp-server packetsize 500
# snmp-server location updated location entry
# snmp-server contact contact updated using merged
# snmp-server enable traps tty
# snmp-server enable traps ospf state-change
# snmp-server enable traps ospf errors
# snmp-server enable traps ospf retransmit
# snmp-server enable traps ospf lsa
# snmp-server enable traps ospf cisco-specific state-change nssa-trans-change
# snmp-server enable traps ospf cisco-specific state-change shamlink interface
# snmp-server enable traps ospf cisco-specific state-change shamlink neighbor
# snmp-server enable traps ospf cisco-specific errors
# snmp-server enable traps ospf cisco-specific retransmit
# snmp-server enable traps ospf cisco-specific lsa
# snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency
# snmp-server enable traps msdp
# snmp-server enable traps syslog
# snmp-server host 172.16.2.9 informs version 2c mergedComm msdp stun pki
# snmp-server host 172.16.2.9 mergedComm slb pki
# snmp-server file-transfer access-group test protocol ftp
# snmp-server password-policy MergedPolicy define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3
# snmp-server password-policy MergedPolicy2 define min-len 12 upper-case 12 special-char 22 change 43
# snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11
# Gathered play:
# --------------
- name: Gather listed snmp config
cisco.ios.ios_snmp_server:
state: gathered
# Module Execution Result:
# ------------------------
# "gathered": {
# "communities": [
# {
# "acl_v4": "acl_uq",
# "name": "communityOvverriden",
# "rw": true
# },
# {
# "acl_v4": "testACL",
# "name": "mergedComm",
# "rw": true
# }
# ],
# "contact": "contact updated using merged",
# "engine_id": [
# {
# "id": "AB0C5342FF0F",
# "remote": {
# "host": "172.16.0.12",
# "udp_port": 25
# }
# }
# ],
# "file_transfer": {
# "access_group": "test",
# "protocol": [
# "ftp"
# ]
# },
# "groups": [
# {
# "group": "mergedGroup",
# "version": "v3",
# "version_option": "auth"
# }
# ],
# "hosts": [
# {
# "community_string": "mergedComm",
# "host": "172.16.2.9",
# "informs": true,
# "traps": [
# "msdp",
# "stun",
# "pki"
# ],
# "version": "2c"
# },
# {
# "community_string": "mergedComm",
# "host": "172.16.2.9",
# "traps": [
# "slb",
# "pki"
# ]
# }
# ],
# "location": "updated location entry",
# "packet_size": 500,
# "password_policy": [
# {
# "change": 3,
# "digits": 23,
# "lower_case": 12,
# "max_len": 24,
# "policy_name": "MergedPolicy",
# "special_char": 32,
# "upper_case": 12
# },
# {
# "change": 43,
# "min_len": 12,
# "policy_name": "MergedPolicy2",
# "special_char": 22,
# "upper_case": 12
# },
# {
# "change": 11,
# "digits": 23,
# "max_len": 12,
# "min_len": 12,
# "policy_name": "policy3",
# "special_char": 22,
# "upper_case": 12
# }
# ],
# "traps": {
# "cef": {
# "enable": true,
# "inconsistency": true,
# "peer_fib_state_change": true,
# "peer_state_change": true,
# "resource_failure": true
# },
# "msdp": true,
# "ospf": {
# "cisco_specific": {
# "error": true,
# "lsa": true,
# "retransmit": true,
# "state_change": {
# "nssa_trans_change": true,
# "shamlink": {
# "interface": true,
# "neighbor": true
# }
# }
# },
# "error": true,
# "lsa": true,
# "retransmit": true,
# "state_change": true
# },
# "syslog": true,
# "tty": true
# },
# "users": [
# {
# "acl_v4": "24",
# "group": "dev",
# "username": "userPaul",
# "version": "v1"
# }
# ]
# },
# Using state: rendered
# Rendered play:
# --------------
- name: Render the commands for provided configuration
cisco.ios.ios_snmp_server:
config:
accounting:
command: default
cache: 2
chassis_id: entry for chassis id
communities:
- acl_v6: te
name: test
ro: true
view: terst1
- acl_v4: '1322'
name: wete
ro: true
- acl_v4: paul
name: weteww
rw: true
contact: details contact
context:
- contextA
- contextB
engine_id:
- id: AB0C5342FA0A
local: true
- id: AB0C5342FAAB
remote:
host: 172.16.0.2
udp_port: 23
- id: AB0C5342FAAA
remote:
host: 172.16.0.1
udp_port: 22
file_transfer:
access_group: testAcl
protocol:
- ftp
- rcp
groups:
- group: grpFamily
version: v3
version_option: auth
- context: mycontext
group: grpFamily
version: v1
- acl_v4: '2'
group: grp1
notify: me
version: v1
- group: newtera
version: v3
version_option: priv
- group: relaplacing
version: v3
version_option: noauth
hosts:
- community_string: check
host: 172.16.2.99
informs: true
traps:
- msdp
- stun
version: 2c
- community_string: check
host: 172.16.2.99
traps:
- slb
- pki
- community_string: checktrap
host: 172.16.2.99
traps:
- isis
- hsrp
- community_string: newtera
host: 172.16.2.1
traps:
- rsrb
- pim
- rsvp
- slb
- pki
version: '3'
version_option: priv
- community_string: relaplacing
host: 172.16.2.1
traps:
- slb
- pki
version: '3'
version_option: noauth
- community_string: trapsac
host: 172.16.2.1
traps:
- tty
- bgp
version: 2c
- community_string: www
host: 172.16.1.1
traps:
- tty
- bgp
version: '3'
version_option: auth
inform:
pending: 2
ip:
dscp: 2
location: 'entry for snmp location'
packet_size: 500
password_policy:
- change: 3
digits: 23
lower_case: 12
max_len: 24
policy_name: policy1
special_char: 32
upper_case: 12
- change: 9
min_len: 12
policy_name: policy2
special_char: 22
upper_case: 12
- change: 11
digits: 23
max_len: 12
min_len: 12
policy_name: policy3
special_char: 22
upper_case: 12
queue_length: 2
source_interface: Loopback999
system_shutdown: true
trap_source: GigabitEthernet0/0
trap_timeout: 2
traps:
auth_framework:
enable: true
bgp:
cbgp2: true
enable: true
bfd:
enable: true
session_down: true
session_up: true
bridge:
enable: true
newroot: true
topologychange: true
casa: true
cef:
enable: true
inconsistency: true
peer_fib_state_change: true
peer_state_change: true
resource_failure: true
dlsw:
enable: true
eigrp: true
ethernet:
cfm:
alarm: true
evc:
status: true
event_manager: true
flowmon: true
frame_relay:
enable: true
subif:
enable: true
hsrp: true
ike:
policy:
add: true
delete: true
tunnel:
start: true
stop: true
ipmulticast: true
ipsec:
cryptomap:
add: true
attach: true
delete: true
detach: true
too_many_sas: true
tunnel:
start: true
stop: true
ipsla: true
l2tun:
pseudowire_status: true
session: true
msdp: true
ospf:
cisco_specific:
error: true
lsa: true
retransmit: true
state_change:
nssa_trans_change: true
shamlink:
interface: true
neighbor: true
error: true
lsa: true
retransmit: true
state_change: true
pim:
enable: true
invalid_pim_message: true
neighbor_change: true
rp_mapping_change: true
pki: true
rsvp: true
snmp:
authentication: true
coldstart: true
linkdown: true
linkup: true
warmstart: true
syslog: true
tty: true
users:
- acl_v4: '24'
group: groupFamily
username: paul
version: v1
- acl_v4: ipv6
group: groupFamily
username: domnic
version: v3
- group: relaplacing
username: relaplacing
version: v3
state: rendered
# Module Execution Result:
# ------------------------
# "rendered": [
# "snmp-server accounting commands default",
# "snmp-server cache interval 2",
# "snmp-server chassis-id entry for chassis id",
# "snmp-server contact details contact",
# "snmp-server file-transfer access-group testAcl protocol ftp rcp",
# "snmp-server inform pending 2",
# "snmp-server ip dscp 2",
# "snmp-server location entry for snmp location",
# "snmp-server packetsize 500",
# "snmp-server queue-length 2",
# "snmp-server trap timeout 2",
# "snmp-server source-interface informs Loopback999",
# "snmp-server trap-source GigabitEthernet0/0",
# "snmp-server system-shutdown",
# "snmp-server enable traps auth-framework",
# "snmp-server enable traps bfd session-down session-up",
# "snmp-server enable traps bgp cbgp2",
# "snmp-server enable traps bridge newroot topologychange",
# "snmp-server enable traps casa",
# "snmp-server enable traps eigrp",
# "snmp-server enable traps event-manager",
# "snmp-server enable traps flowmon",
# "snmp-server enable traps hsrp",
# "snmp-server enable traps ipsla",
# "snmp-server enable traps msdp",
# "snmp-server enable traps pki",
# "snmp-server enable traps rsvp",
# "snmp-server enable traps syslog",
# "snmp-server enable traps tty",
# "snmp-server enable traps ipmulticast",
# "snmp-server enable traps ike policy add",
# "snmp-server enable traps ike policy delete",
# "snmp-server enable traps ike tunnel start",
# "snmp-server enable traps ike tunnel stop",
# "snmp-server enable traps ipsec cryptomap add",
# "snmp-server enable traps ipsec cryptomap delete",
# "snmp-server enable traps ipsec cryptomap attach",
# "snmp-server enable traps ipsec cryptomap detach",
# "snmp-server enable traps ipsec tunnel start",
# "snmp-server enable traps ipsec tunnel stop",
# "snmp-server enable traps ipsec too-many-sas",
# "snmp-server enable traps ospf cisco-specific errors",
# "snmp-server enable traps ospf cisco-specific retransmit",
# "snmp-server enable traps ospf cisco-specific lsa",
# "snmp-server enable traps ospf cisco-specific state-change nssa-trans-change",
# "snmp-server enable traps ospf cisco-specific state-change shamlink interface",
# "snmp-server enable traps ospf cisco-specific state-change shamlink neighbor",
# "snmp-server enable traps ospf errors",
# "snmp-server enable traps ospf retransmit",
# "snmp-server enable traps ospf lsa",
# "snmp-server enable traps ospf state-change",
# "snmp-server enable traps l2tun pseudowire status",
# "snmp-server enable traps l2tun session",
# "snmp-server enable traps pim neighbor-change rp-mapping-change invalid-pim-message",
# "snmp-server enable traps snmp authentication linkdown linkup warmstart coldstart",
# "snmp-server enable traps frame-relay",
# "snmp-server enable traps cef resource-failure peer-state-change peer-fib-state-change inconsistency",
# "snmp-server enable traps dlsw",
# "snmp-server enable traps ethernet evc status",
# "snmp-server enable traps ethernet cfm alarm",
# "snmp-server host 172.16.2.99 informs version 2c check msdp stun",
# "snmp-server host 172.16.2.99 check slb pki",
# "snmp-server host 172.16.2.99 checktrap isis hsrp",
# "snmp-server host 172.16.2.1 version 3 priv newtera rsrb pim rsvp slb pki",
# "snmp-server host 172.16.2.1 version 3 noauth relaplacing slb pki",
# "snmp-server host 172.16.2.1 version 2c trapsac tty bgp",
# "snmp-server host 172.16.1.1 version 3 auth www tty bgp",
# "snmp-server group grpFamily v1 context mycontext",
# "snmp-server group grp1 v1 notify me access 2",
# "snmp-server group newtera v3 priv",
# "snmp-server group relaplacing v3 noauth",
# "snmp-server engineID local AB0C5342FA0A",
# "snmp-server engineID remote 172.16.0.2 udp-port 23 AB0C5342FAAB",
# "snmp-server engineID remote 172.16.0.1 udp-port 22 AB0C5342FAAA",
# "snmp-server community test view terst1 ro ipv6 te",
# "snmp-server community wete ro 1322",
# "snmp-server community weteww rw paul",
# "snmp-server context contextA",
# "snmp-server context contextB",
# "snmp-server password-policy policy1 define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3",
# "snmp-server password-policy policy2 define min-len 12 upper-case 12 special-char 22 change 9",
# "snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11",
# "snmp-server user paul groupFamily v1 access 24",
# "snmp-server user domnic groupFamily v3 access ipv6",
# "snmp-server user relaplacing relaplacing v3"
# ]
# Using state: parsed
# File: parsed.cfg
# ----------------
# snmp-server engineID local AB0C5342FA0A
# snmp-server engineID remote 172.16.0.2 udp-port 23 AB0C5342FAAB
# snmp-server engineID remote 172.16.0.1 udp-port 22 AB0C5342FAAA
# snmp-server user newuser newfamily v1 access 24
# snmp-server user paul familypaul v3 access ipv6 ipv6acl
# snmp-server user replaceUser replaceUser v3
# snmp-server group group0 v3 auth
# snmp-server group group1 v1 notify me access 2
# snmp-server group group2 v3 priv
# snmp-server group replaceUser v3 noauth
# snmp-server community commu1 view view1 RO ipv6 te
# snmp-server community commu2 RO 1322
# snmp-server community commu3 RW paul
# snmp-server trap timeout 2
# snmp-server trap-source GigabitEthernet0/0
# snmp-server source-interface informs Loopback999
# snmp-server packetsize 500
# snmp-server enable traps vrfmib vrf-up vrf-down vnet-trunk-up vnet-trunk-down
# snmp-server host 172.16.2.99 informs version 2c check msdp stun
# snmp-server host 172.16.2.1 version 2c trapsac tty bgp
# snmp-server host 172.16.1.1 version 3 auth group0 tty bgp
# snmp-server context contextWord1
# snmp-server context contextWord2
# snmp-server file-transfer access-group testAcl protocol ftp
# snmp-server file-transfer access-group testAcl protocol rcp
# snmp-server cache interval 2
# snmp-server password-policy policy2 define min-len 12 upper-case 12 special-char 22 change 9
# snmp-server password-policy policy3 define min-len 12 max-len 12 upper-case 12 special-char 22 digits 23 change 11
# snmp-server accounting commands default
# snmp-server inform pending 2
# Parsed play:
# ------------
- name: Parse the provided configuration with the existing running configuration
cisco.ios.ios_snmp_server:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Module Execution Result:
# ------------------------
# "parsed": {
# "accounting": {
# "command": "default"
# },
# "cache": 2,
# "communities": [
# {
# "acl_v6": "te",
# "name": "commu1",
# "ro": true,
# "view": "view1"
# },
# {
# "acl_v4": "1322",
# "name": "commu2",
# "ro": true
# },
# {
# "acl_v4": "paul",
# "name": "commu3",
# "rw": true
# }
# ],
# "context": [
# "contextWord1",
# "contextWord2"
# ],
# "engine_id": [
# {
# "id": "AB0C5342FA0A",
# "local": true
# },
# {
# "id": "AB0C5342FAAA",
# "remote": {
# "host": "172.16.0.1",
# "udp_port": 22
# }
# },
# {
# "id": "AB0C5342FAAB",
# "remote": {
# "host": "172.16.0.2",
# "udp_port": 23
# }
# }
# ],
# "file_transfer": {
# "access_group": "testAcl",
# "protocol": [
# "rcp",
# "ftp"
# ]
# },
# "groups": [
# {
# "group": "group0",
# "version": "v3",
# "version_option": "auth"
# },
# {
# "acl_v4": "2",
# "group": "group1",
# "notify": "me",
# "version": "v1"
# },
# {
# "group": "group2",
# "version": "v3",
# "version_option": "priv"
# },
# {
# "group": "replaceUser",
# "version": "v3",
# "version_option": "noauth"
# }
# ],
# "hosts": [
# {
# "community_string": "group0",
# "host": "172.16.1.1",
# "traps": [
# "tty",
# "bgp"
# ],
# "version": "3",
# "version_option": "auth"
# },
# {
# "community_string": "trapsac",
# "host": "172.16.2.1",
# "traps": [
# "tty",
# "bgp"
# ],
# "version": "2c"
# },
# {
# "community_string": "check",
# "host": "172.16.2.99",
# "informs": true,
# "traps": [
# "msdp",
# "stun"
# ],
# "version": "2c"
# }
# ],
# "inform": {
# "pending": 2
# },
# "packet_size": 500,
# "password_policy": [
# {
# "change": 9,
# "min_len": 12,
# "policy_name": "policy2",
# "special_char": 22,
# "upper_case": 12
# },
# {
# "change": 11,
# "digits": 23,
# "max_len": 12,
# "min_len": 12,
# "policy_name": "policy3",
# "special_char": 22,
# "upper_case": 12
# }
# ],
# "source_interface": "Loopback999",
# "trap_source": "GigabitEthernet0/0",
# "trap_timeout": 2,
# "traps": {
# "vrfmib": {
# "vnet_trunk_down": true,
# "vnet_trunk_up": true,
# "vrf_down": true,
# "vrf_up": true
# }
# },
# "users": [
# {
# "acl_v4": "24",
# "group": "newfamily",
# "username": "newuser",
# "version": "v1"
# },
# {
# "acl_v4": "ipv6",
# "group": "familypaul",
# "username": "paul",
# "version": "v3"
# },
# {
# "group": "replaceUser",
# "username": "replaceUser",
# "version": "v3"
# }
# ]
# }
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The resulting configuration after module execution. Returned: when changed Sample: “This output will always be in the same format as the module argspec.\n” |
|
The configuration prior to the module execution. Returned: when state is Sample: “This output will always be in the same format as the module argspec.\n” |
|
The set of commands pushed to the remote device. Returned: when state is Sample: [“snmp-server host 172.16.2.99 informs version 2c check msdp stun”, “snmp-server engineID remote 172.16.0.2 udp-port 23 AB0C5342FAAB”, “snmp-server group grp1 v1 notify me access 2”] |
|
Facts about the network resource gathered from the remote device as structured data. Returned: when state is Sample: “This output will always be in the same format as the module argspec.\n” |
|
The device native config provided in running_config option parsed into structured data as per module argspec. Returned: when state is Sample: “This output will always be in the same format as the module argspec.\n” |
|
The provided configuration in the task rendered in device-native format (offline). Returned: when state is Sample: [“snmp-server enable traps ipsec cryptomap attach”, “snmp-server password-policy policy1 define max-len 24 upper-case 12 lower-case 12 special-char 32 digits 23 change 3”, “snmp-server cache interval 2”] |
Authors
Sagar Paul (@KB-perByte)