cisco.nxos.nxos_snmp_server module – SNMP Server resource module.
Note
This module is part of the cisco.nxos collection (version 4.4.0).
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.nxos
.
To use it in a playbook, specify: cisco.nxos.nxos_snmp_server
.
New in cisco.nxos 2.8.0
Synopsis
This module manages SNMP server configuration on devices running Cisco NX-OS.
Note
This module has a corresponding action plugin.
Parameters
Parameter |
Comments |
---|---|
A dict of SNMP server configuration |
|
Set duration for which aaa-cached snmp user exists. |
|
Timeout for which aaa-cached user exists(in secs). |
|
Set community string and access privs. |
|
Group to which the community belongs. |
|
SNMP community string (Max Size 32). |
|
Read-only access with this community string. Choices:
|
|
Read-write access with this community string. Choices:
|
|
Specify IPv4 ACL, the ACL name specified must be IPv4 ACL. This option is unsupported on MDS switches. |
|
Specify IPv6 ACL, the ACL name specified after must be IPv6 ACL. This option is unsupported on MDS switches. |
|
Modify sysContact. |
|
SNMP context to be mapped. |
|
Name of the protocol instance (Max Size 32). |
|
Name of the SNMP context (Max Size 32). |
|
Topology associated with the SNMP context. |
|
VRF associated with the SNMP context. This option is unsupported on MDS switches. |
|
Configure port counter configuration. This option is unsupported on MDS switches. |
|
Port stats cache. |
|
Enable port stats cache. Choices:
|
|
Timeout for which cached port stats exists(in secs). |
|
Silently drop unknown v3 user packets. This option is unsupported on MDS switches. |
|
Unknown v3 engine id. Choices:
|
|
Unknown v3 user. Choices:
|
|
Configure a local SNMPv3 engineID. This option is unsupported on MDS switches. |
|
EngineID of the local agent. |
|
Globally enforce privacy for all the users. Choices:
|
|
Specify hosts to receive SNMP notifications. SNMP hosts config lines that appear separately in running-config must be added as individual dictionaries. |
|
Use the SNMPv3 authNoPriv Security Level. |
|
SNMP community string or SNMPv3 user name (Max Size 32). |
|
Filters notifications to the notification host receiver based on the configured VRF. This option is unsupported on MDS switches. |
|
IPv4 or IPv6 address or DNS Name of SNMP notification host. |
|
Send Inform messages to this host. Choices:
|
|
Use the SNMPv3 authPriv Security Level. |
|
Source interface to be used for sending out SNMP notifications to this host. |
|
Send Traps messages to this host. Choices:
|
|
The notification host’s UDP port number. |
|
Configures SNMP to use the selected VRF to communicate with the host receiver. This option is unsupported on MDS switches. |
|
SNMP version to use for notification messages. Choices:
|
|
Modify sysLocation. |
|
Mib access parameters. |
|
SNMP community. |
|
SNMP community string (Max Size 32). |
|
Name of the SNMP context (Max Size 32). |
|
Largest SNMP packet size |
|
Snmp protocol operations. |
|
Enable/Disable snmp protocol operations. Choices:
|
|
Source interface to be used for sending out SNMP notifications. This option is unsupported on MDS switches. |
|
SNMP Inform notifications for which this source interface needs to be used. |
|
SNMP Trap notifications for which this source interface needs to be used. |
|
Configure snmp-server for reload(2). Choices:
|
|
Enable one time authentication for snmp over tcp session. |
|
Enable one time authentication for snmp over tcp session. Choices:
|
|
Enable tcp-session. This option is unsupported on MDS switches. Choices:
|
|
Enable SNMP Traps |
|
AAA traps |
|
Enable AAA traps. Choices:
|
|
AAA server state change notification. Choices:
|
|
SNMP BGP traps. |
|
Enable SNMP BGP traps. Choices:
|
|
Bridge traps. This option is unsupported on MDS switches. |
|
Enable bridge traps. Choices:
|
|
Enable SNMP STP Bridge MIB newroot traps. Choices:
|
|
Enable SNMP STP Bridge MIB topologychange traps. Choices:
|
|
Callhome traps. |
|
Enable callhome traps. This option is unsupported on MDS switches. Choices:
|
|
Callhome External Event Notification. Choices:
|
|
SMTP Message Send Fail notification. Choices:
|
|
CFS traps. |
|
Enable cfs traps. This option is unsupported on MDS switches. Choices:
|
|
Merge failure notification. Choices:
|
|
State change notification. Choices:
|
|
Config traps. |
|
Running config change trap. Choices:
|
|
Enable config traps. This option is unsupported on MDS switches. Choices:
|
|
Entity traps. |
|
CefcMIBEnableStatusNotification. Choices:
|
|
Enable entity traps. Choices:
|
|
Entity Fan Status Change. Choices:
|
|
Entity MIB change. Choices:
|
|
Entity Module Inserted. Choices:
|
|
Entity Module Removed. Choices:
|
|
Entity Module Status Change. Choices:
|
|
Entity Power Out Change. Choices:
|
|
Entity Power Status Change. Choices:
|
|
Entity sensor. Choices:
|
|
Entity Unrecognised Module. Choices:
|
|
Feature-Control traps. |
|
Feature operation status change Notification. Choices:
|
|
Enable feature-control traps. This option is unsupported on MDS switches. Choices:
|
|
Feature operation status change notification. Choices:
|
|
Generic traps. |
|
Generic coldStart trap. Choices:
|
|
Enable generic traps. This option is unsupported on MDS switches. Choices:
|
|
Generic warmStart trap. Choices:
|
|
License traps. |
|
Enable license traps. This option is unsupported on MDS switches. Choices:
|
|
License Expiry Notification. Choices:
|
|
License Expiry Warning Notification. Choices:
|
|
License File Missing Notification. Choices:
|
|
No License installed for feature Notification. Choices:
|
|
Link traps. |
|
Err-disable state notification. This option is unsupported on MDS switches. Choices:
|
|
Cisco extended link state down notification. Choices:
|
|
Cisco extended link state up notification. Choices:
|
|
Cisco interface transceiver monitor status change notification. Choices:
|
|
Mac addr move trap. This option is unsupported on MDS switches. Choices:
|
|
Delayed link state change. Choices:
|
|
Enable link traps. This option is unsupported on MDS switches. Choices:
|
|
IETF extended link state down notification. Choices:
|
|
IETF extended link state up notification. Choices:
|
|
IETF Link state down notification. Choices:
|
|
IETF Link state up notification. Choices:
|
|
MMode traps. This option is unsupported on MDS switches. |
|
Maint Mode Change Notification. Choices:
|
|
Normal Mode Change Notification. Choices:
|
|
Enable mmode traps. Choices:
|
|
SNMP OSPF traps. |
|
Enable SNMP OSPF traps. Choices:
|
|
SNMP OSPFv3 traps. |
|
Enable SNMP OSPFv3 traps. Choices:
|
|
RF traps. |
|
Enable rf traps. This option is unsupported on MDS switches. Choices:
|
|
Redundancy_Framework (RF) Sup switchover MIB. Choices:
|
|
RMON traps. |
|
Enable rmon traps. This option is unsupported on MDS switches. Choices:
|
|
Rmon falling alarm. Choices:
|
|
High capacity Rmon falling alarm. Choices:
|
|
High capacity Rmon rising alarm. Choices:
|
|
Rmon rising alarm. Choices:
|
|
SNMP traps. |
|
SNMP authentication trap. Choices:
|
|
Enable snmp traps. This option is unsupported on MDS switches. Choices:
|
|
Storm-Control traps. |
|
Port-Storm-Control-Event. This option is unsupported on MDS switches. Choices:
|
|
Enable storm-control traps. This option is unsupported on MDS switches. Choices:
|
|
Number of traps per minute. Choices:
|
|
Stpx traps. This option is unsupported on MDS switches. |
|
Enable stpx traps. Choices:
|
|
Enable SNMP STPX MIB InconsistencyUpdate traps. Choices:
|
|
Enable SNMP STPX MIB LoopInconsistencyUpdate traps. Choices:
|
|
Enable SNMP STPX MIB RootInconsistencyUpdate traps. Choices:
|
|
Enable syslog traps. |
|
Enable syslog traps. This option is unsupported on MDS switches. Choices:
|
|
Message Generated Notification. Choices:
|
|
Sysmgr traps. |
|
Software Core Notification. Choices:
|
|
Enable sysmgr traps. This option is unsupported on MDS switches. Choices:
|
|
System traps. |
|
Clock-change-notification traps. Choices:
|
|
Enable system traps. This option is unsupported on MDS switches. Choices:
|
|
Upgrade traps. |
|
Enable upgrade traps. This option is unsupported on MDS switches. Choices:
|
|
Upgrade Job Status Notification. Choices:
|
|
Upgrade Global Status Notification. Choices:
|
|
VTP traps. This option is unsupported on MDS switches. |
|
Enable VTP traps. Choices:
|
|
Enable vtpConfigRevNumberError vtpConfigDigestEnable vtpConfigRevNumberError vtpConfigDigestError vtpServerDisabled vtpVersionOneDeviceDetected vlanTrunkPortDynamicStatusChange vtpLocalModeChanged vtpVersionInUseChanged notification. Choices:
|
|
Enable vtpVlanCreated notification. Choices:
|
|
Enable vtpVlanDeleted notification. Choices:
|
|
Define users who can access the SNMP engine. |
|
SNMP User authentication related settings |
|
Authentication parameters for the user. |
|
Select algorithm for authentication. Choices:
|
|
EngineID for configuring notif target user (for V3 informs). This value needs to be enclosed in quotes in the task. |
|
Specifies whether the passwords are in localized key format. Choices:
|
|
Specifies whether the passwords are in localized V2 key format. Choices:
|
|
Authentication password for user (Max Size 127). If this value is localized, it has to be enclosed in quotes in the task. |
|
Encryption parameters for the user. |
|
Use 128-bit AES algorithm for privacy. Choices:
|
|
Privacy password for user (Max Size 130). If this value is localized, it has to be enclosed in quotes in the task. |
|
Group name (ignored for notif target user) (Max Size 28). |
|
Name of the user (Max Size 28). |
|
Set IPv4 and IPv6 ACL to use. |
|
Specify IPv4 ACL, the ACL name specified after must be IPv4 ACL. |
|
Specify IPv6 ACL, the ACL name specified after must be IPv6 ACL. |
|
Name of the user (Max Size 28). |
|
This option is used only with state parsed. The value of this option should be the output received from the NX-OS device by executing the command show running-config | section ‘^snmp-server’. The state parsed reads the configuration from |
|
The state the configuration should be left in. The states Please refer to examples for more details. Choices:
|
Notes
Note
Tested against NX-OS 9.3.6 on Cisco Nexus Switches.
This module works with connection
network_cli
andhttpapi
.Tested against Cisco MDS NX-OS 9.2(2) with connection
network_cli
.
Examples
# Using merged
# Before state:
# -------------
# nxos-9k-rdo# show running-config | section "^snmp-server"
# snmp-server user admin network-admin auth md5 0xcbde46b02c46e0bcd3ac5af6a8b13da9 priv 0xcbde46b02c46e0bcd3ac5af6a8b13da9 localizedkey
- name: Merge the provided configuration with the existing running configuration
cisco.nxos.nxos_snmp_server:
config:
aaa_user:
cache_timeout: 36000
communities:
- community: public
group: network-operator
- community: private
group: network-admin
contact: nxosswitchadmin@localhost
location: serverroom-1
traps:
aaa:
server_state_change: True
system:
clock_change_notification: True
hosts:
- host: 192.0.2.1
traps: True
version: '1'
community: public
- host: 192.0.2.1
source_interface: Ethernet1/1
- host: 192.0.2.2
informs: True
version: '3'
auth: NMS
users:
auth:
- user: snmp_user_1
group: network-operator
authentication:
algorithm: md5
password: '0x5632724fb8ac3699296af26281e1d0f1'
localized_key: True
- user: snmp_user_2
group: network-operator
authentication:
algorithm: md5
password: '0x5632724fb8ac3699296af26281e1d0f1'
localized_key: True
priv:
privacy_password: '0x5632724fb8ac3699296af26281e1d0f1'
aes_128: True
use_acls:
- user: snmp_user_1
ipv4: acl1
ipv6: acl2
- user: snmp_user_2
ipv4: acl3
ipv6: acl4
# Task output
# -------------
# before:
# users:
# auth:
# - user: admin
# group: network-admin
# authentication:
# algorithm: md5
# password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
# localized_key: True
# priv:
# privacy_password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
#
# commands:
# - snmp-server contact nxosswitchadmin@localhost
# - snmp-server location serverroom-1
# - snmp-server aaa-user cache-timeout 36000
# - snmp-server user snmp_user_1 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# - snmp-server user snmp_user_2 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 priv aes-128 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# - snmp-server user snmp_user_1 use-ipv4acl acl1 use-ipv6acl acl2
# - snmp-server user snmp_user_2 use-ipv4acl acl3 use-ipv6acl acl4
# - snmp-server host 192.0.2.1 traps version 1 public
# - snmp-server host 192.0.2.1 source-interface Ethernet1/1
# - snmp-server host 192.0.2.2 informs version 3 auth NMS
# - snmp-server community private group network-admin
# - snmp-server community public group network-operator
# - snmp-server enable traps aaa server-state-change
# - snmp-server enable traps system Clock-change-notification
#
# after:
# aaa_user:
# cache_timeout: 36000
# communities:
# - community: private
# group: network-admin
# - community: public
# group: network-operator
# contact: nxosswitchadmin@localhost
# location: serverroom-1
# traps:
# aaa:
# server_state_change: True
# system:
# clock_change_notification: True
# hosts:
# - host: 192.0.2.1
# traps: true
# version: "1"
# community: public
#
# - host: 192.0.2.1
# source_interface: Ethernet1/1
#
# - host: 192.0.2.2
# informs: true
# version: "3"
# auth: NMS
# users:
# auth:
# - user: admin
# group: network-admin
# authentication:
# algorithm: md5
# password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
# localized_key: True
# priv:
# privacy_password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
#
# - user: snmp_user_1
# group: network-operator
# authentication:
# algorithm: md5
# password: "0x5632724fb8ac3699296af26281e1d0f1"
# localized_key: True
#
# - authentication:
# algorithm: md5
# localized_key: true
# password: "0x5632724fb8ac3699296af26281e1d0f1"
# priv:
# aes_128: true
# privacy_password: "0x5632724fb8ac3699296af26281e1d0f1"
# group: network-operator
# user: snmp_user_2
#
# use_acls:
# - user: snmp_user_1
# ipv4: acl1
# ipv6: acl2
# - user: snmp_user_2
# ipv4: acl3
# ipv6: acl4
# After state:
# ------------
# nxos-9k-rdo# show running-config | section "^snmp-server"
# snmp-server contact nxosswitchadmin@localhost
# snmp-server location serverroom-1
# snmp-server aaa-user cache-timeout 36000
# snmp-server user admin network-admin auth md5 0xcbde46b02c46e0bcd3ac5af6a8b13da9 priv 0xcbde46b02c46e0bcd3ac5af6a8b13da9 localizedkey
# snmp-server user snmp_user_1 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# snmp-server user snmp_user_2 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 priv aes-128 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# snmp-server user snmp_user_1 use-ipv4acl acl1 use-ipv6acl acl2
# snmp-server user snmp_user_2 use-ipv4acl acl3 use-ipv6acl acl4
# snmp-server host 192.0.2.1 traps version 1 public
# snmp-server host 192.0.2.1 source-interface Ethernet1/1
# snmp-server host 192.0.2.2 informs version 3 auth NMS
# snmp-server community private group network-admin
# snmp-server community public group network-operator
# snmp-server enable traps aaa server-state-change
# snmp-server enable traps system Clock-change-notification
# Using replaced
# Before state:
# ------------
# nxos-9k-rdo# show running-config | section "^snmp-server"
# snmp-server contact nxosswitchadmin@localhost
# snmp-server location serverroom-1
# snmp-server aaa-user cache-timeout 36000
# snmp-server user admin network-admin auth md5 0xcbde46b02c46e0bcd3ac5af6a8b13da9 priv 0xcbde46b02c46e0bcd3ac5af6a8b13da9 localizedkey
# snmp-server user snmp_user_1 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# snmp-server user snmp_user_2 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 priv aes-128 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# snmp-server user snmp_user_1 use-ipv4acl acl1 use-ipv6acl acl2
# snmp-server user snmp_user_2 use-ipv4acl acl3 use-ipv6acl acl4
# snmp-server host 192.0.2.1 traps version 1 public
# snmp-server host 192.0.2.1 source-interface Ethernet1/1
# snmp-server host 192.0.2.2 informs version 3 auth NMS
# snmp-server community private group network-admin
# snmp-server community public group network-operator
# snmp-server enable traps aaa server-state-change
# snmp-server enable traps system Clock-change-notification
- name: Replace snmp-server configurations of listed snmp-server with provided configurations
cisco.nxos.nxos_snmp_server:
config:
aaa_user:
cache_timeout: 36000
communities:
- community: public
group: network-operator
- community: secret
group: network-operator
contact: nxosswitchadmin2@localhost
location: serverroom-2
traps:
aaa:
server_state_change: True
hosts:
- host: 192.0.2.1
traps: True
version: '1'
community: public
- host: 192.0.2.1
source_interface: Ethernet1/1
- host: 192.0.3.2
informs: True
version: '3'
auth: NMS
users:
auth:
- user: admin
group: network-admin
authentication:
algorithm: md5
password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
localized_key: True
priv:
privacy_password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
- user: snmp_user_1
group: network-operator
authentication:
algorithm: md5
password: '0x5632724fb8ac3699296af26281e1d0f1'
localized_key: True
- user: snmp_user_2
group: network-operator
authentication:
algorithm: md5
password: '0x5632724fb8ac3699296af26281e1d0f1'
localized_key: True
priv:
privacy_password: '0x5632724fb8ac3699296af26281e1d0f1'
aes_128: True
use_acls:
- user: snmp_user_1
ipv4: acl1
ipv6: acl2
state: replaced
# Task output
# -------------
# before:
# aaa_user:
# cache_timeout: 36000
# communities:
# - community: private
# group: network-admin
# - community: public
# group: network-operator
# contact: nxosswitchadmin@localhost
# location: serverroom-1
# traps:
# aaa:
# server_state_change: True
# system:
# clock_change_notification: True
# hosts:
# - host: 192.0.2.1
# traps: true
# version: "1"
# community: public
#
# - host: 192.0.2.1
# source_interface: Ethernet1/1
#
# - host: 192.0.2.2
# informs: true
# version: "3"
# auth: NMS
# users:
# auth:
# - user: admin
# group: network-admin
# authentication:
# algorithm: md5
# password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
# localized_key: True
# priv:
# privacy_password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
#
# - user: snmp_user_1
# group: network-operator
# authentication:
# algorithm: md5
# password: "0x5632724fb8ac3699296af26281e1d0f1"
# localized_key: True
#
# - authentication:
# algorithm: md5
# localized_key: true
# password: "0x5632724fb8ac3699296af26281e1d0f1"
# priv:
# aes_128: true
# privacy_password: "0x5632724fb8ac3699296af26281e1d0f1"
# group: network-operator
# user: snmp_user_2
#
# use_acls:
# - user: snmp_user_1
# ipv4: acl1
# ipv6: acl2
# - user: snmp_user_2
# ipv4: acl3
# ipv6: acl4
#
# commands:
# - snmp-server contact nxosswitchadmin2@localhost
# - no snmp-server enable traps system Clock-change-notification
# - snmp-server location serverroom-2
# - no snmp-server user snmp_user_2 use-ipv4acl acl3 use-ipv6acl acl4
# - no snmp-server host 192.0.2.2 informs version 3 auth NMS
# - snmp-server host 192.0.3.2 informs version 3 auth NMS
# - no snmp-server community private group network-admin
# - snmp-server community secret group network-operator
#
# after:
# aaa_user:
# cache_timeout: 36000
# communities:
# - community: public
# group: network-operator
# - community: secret
# group: network-operator
# contact: nxosswitchadmin2@localhost
# location: serverroom-2
# traps:
# aaa:
# server_state_change: True
# hosts:
# - host: 192.0.2.1
# traps: True
# version: '1'
# community: public
# - host: 192.0.2.1
# source_interface: Ethernet1/1
# - host: 192.0.3.2
# informs: True
# version: '3'
# auth: NMS
# users:
# auth:
# - user: admin
# group: network-admin
# authentication:
# algorithm: md5
# password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
# localized_key: True
# priv:
# privacy_password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
#
# - user: snmp_user_1
# group: network-operator
# authentication:
# algorithm: md5
# password: '0x5632724fb8ac3699296af26281e1d0f1'
# localized_key: True
#
# - user: snmp_user_2
# group: network-operator
# authentication:
# algorithm: md5
# password: '0x5632724fb8ac3699296af26281e1d0f1'
# localized_key: True
# priv:
# privacy_password: '0x5632724fb8ac3699296af26281e1d0f1'
# aes_128: True
#
# use_acls:
# - user: snmp_user_1
# ipv4: acl1
# ipv6: acl2
#
# After state:
# ------------
# nxos-9k-rdo# show running-config | section "^snmp-server"
# snmp-server contact nxosswitchadmin2@localhost
# snmp-server location serverroom-2
# snmp-server aaa-user cache-timeout 36000
# snmp-server user admin network-admin auth md5 0xcbde46b02c46e0bcd3ac5af6a8b13da9 priv 0xcbde46b02c46e0bcd3ac5af6a8b13da9 localizedkey
# snmp-server user snmp_user_1 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# snmp-server user snmp_user_2 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 priv aes-128 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# snmp-server user snmp_user_1 use-ipv4acl acl1 use-ipv6acl acl2
# snmp-server user snmp_user_2 use-ipv4acl acl3 use-ipv6acl acl4
# snmp-server host 192.0.2.1 traps version 1 public
# snmp-server host 192.0.2.1 source-interface Ethernet1/1
# snmp-server host 192.0.2.2 informs version 3 auth NMS
# snmp-server community secret group network-operator
# snmp-server community public group network-operator
# snmp-server enable traps aaa server-state-change
# snmp-server enable traps system Clock-change-notification
# Using deleted
# Before state:
# ------------
# nxos-9k-rdo# show running-config | section "^snmp-server"
# snmp-server contact nxosswitchadmin@localhost
# snmp-server location serverroom-1
# snmp-server aaa-user cache-timeout 36000
# snmp-server user admin network-admin auth md5 0xcbde46b02c46e0bcd3ac5af6a8b13da9 priv 0xcbde46b02c46e0bcd3ac5af6a8b13da9 localizedkey
# snmp-server user snmp_user_1 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# snmp-server user snmp_user_2 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 priv aes-128 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# snmp-server user snmp_user_1 use-ipv4acl acl1 use-ipv6acl acl2
# snmp-server user snmp_user_2 use-ipv4acl acl3 use-ipv6acl acl4
# snmp-server host 192.0.2.1 traps version 1 public
# snmp-server host 192.0.2.1 source-interface Ethernet1/1
# snmp-server host 192.0.2.2 informs version 3 auth NMS
# snmp-server community private group network-admin
# snmp-server community public group network-operator
# snmp-server enable traps aaa server-state-change
# snmp-server enable traps system Clock-change-notification
- name: Delete SNMP Server configurations from the device (admin user will not be deleted)
cisco.nxos.nxos_snmp_server:
state: deleted
# Task output
# -------------
# before:
# aaa_user:
# cache_timeout: 36000
# communities:
# - community: private
# group: network-admin
# - community: public
# group: network-operator
# contact: nxosswitchadmin@localhost
# location: serverroom-1
# traps:
# aaa:
# server_state_change: True
# system:
# clock_change_notification: True
# hosts:
# - host: 192.0.2.1
# traps: true
# version: "1"
# community: public
#
# - host: 192.0.2.1
# source_interface: Ethernet1/1
#
# - host: 192.0.2.2
# informs: true
# version: "3"
# auth: NMS
# users:
# auth:
# - user: admin
# group: network-admin
# authentication:
# algorithm: md5
# password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
# localized_key: True
# priv:
# privacy_password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
#
# - user: snmp_user_1
# group: network-operator
# authentication:
# algorithm: md5
# password: "0x5632724fb8ac3699296af26281e1d0f1"
# localized_key: True
#
# - authentication:
# algorithm: md5
# localized_key: true
# password: "0x5632724fb8ac3699296af26281e1d0f1"
# priv:
# aes_128: true
# privacy_password: "0x5632724fb8ac3699296af26281e1d0f1"
# group: network-operator
# user: snmp_user_2
#
# use_acls:
# - user: snmp_user_1
# ipv4: acl1
# ipv6: acl2
# - user: snmp_user_2
# ipv4: acl3
# ipv6: acl4
#
# commands:
# - no snmp-server contact nxosswitchadmin@localhost
# - no snmp-server location serverroom-1
# - no snmp-server aaa-user cache-timeout 36000
# - no snmp-server user admin network-admin auth md5 0xcbde46b02c46e0bcd3ac5af6a8b13da9 priv 0xcbde46b02c46e0bcd3ac5af6a8b13da9 localizedkey
# - no snmp-server user snmp_user_1 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# - no snmp-server user snmp_user_2 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 priv aes-128 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# - no snmp-server user snmp_user_1 use-ipv4acl acl1 use-ipv6acl acl2
# - no snmp-server user snmp_user_2 use-ipv4acl acl3 use-ipv6acl acl4
# - no snmp-server host 192.0.2.1 traps version 1 public
# - no snmp-server host 192.0.2.1 source-interface Ethernet1/1
# - no snmp-server host 192.0.2.2 informs version 3 auth NMS
# - no snmp-server community private group network-admin
# - no snmp-server community public group network-operator
# - no snmp-server enable traps aaa server-state-change
# - no snmp-server enable traps system Clock-change-notification
#
# after:
# users:
# auth:
# - user: admin
# group: network-admin
# authentication:
# algorithm: md5
# password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
# localized_key: True
# priv:
# privacy_password: "0xcbde46b02c46e0bcd3ac5af6a8b13da9"
# After state:
# ------------
# nxos-9k-rdo# show running-config | section "^snmp-server"
# snmp-server user admin network-admin auth md5 0xcbde46b02c46e0bcd3ac5af6a8b13da9 priv 0xcbde46b02c46e0bcd3ac5af6a8b13da9 localizedkey
# Using rendered
# ---------------
- name: Render platform specific configuration lines with state rendered (without connecting to the device)
cisco.nxos.nxos_snmp_server:
config:
aaa_user:
cache_timeout: 36000
communities:
- community: public
group: network-operator
- community: private
group: network-admin
contact: nxosswitchadmin@localhost
location: serverroom-1
traps:
aaa:
server_state_change: True
system:
clock_change_notification: True
hosts:
- host: 192.0.2.1
traps: True
version: '1'
community: public
- host: 192.0.2.1
source_interface: Ethernet1/1
- host: 192.0.2.2
informs: True
version: '3'
auth: NMS
users:
auth:
- user: snmp_user_1
group: network-operator
authentication:
algorithm: md5
password: '0x5632724fb8ac3699296af26281e1d0f1'
localized_key: True
- user: snmp_user_2
group: network-operator
authentication:
algorithm: md5
password: '0x5632724fb8ac3699296af26281e1d0f1'
localized_key: True
priv:
privacy_password: '0x5632724fb8ac3699296af26281e1d0f1'
aes_128: True
use_acls:
- user: snmp_user_1
ipv4: acl1
ipv6: acl2
- user: snmp_user_2
ipv4: acl3
ipv6: acl4
state: rendered
# Task Output (redacted)
# -----------------------
# rendered:
# - snmp-server contact nxosswitchadmin@localhost
# - snmp-server location serverroom-1
# - snmp-server aaa-user cache-timeout 36000
# - snmp-server user snmp_user_1 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# - snmp-server user snmp_user_2 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 priv aes-128 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# - snmp-server user snmp_user_1 use-ipv4acl acl1 use-ipv6acl acl2
# - snmp-server user snmp_user_2 use-ipv4acl acl3 use-ipv6acl acl4
# - snmp-server host 192.0.2.1 traps version 1 public
# - snmp-server host 192.0.2.1 source-interface Ethernet1/1
# - snmp-server host 192.0.2.2 informs version 3 auth NMS
# - snmp-server community private group network-admin
# - snmp-server community public group network-operator
# - snmp-server enable traps aaa server-state-change
# - snmp-server enable traps system Clock-change-notification
# Using parsed
# parsed.cfg
# ------------
# snmp-server contact nxosswitchadmin@localhost
# snmp-server location serverroom-1
# snmp-server aaa-user cache-timeout 36000
# snmp-server user snmp_user_1 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# snmp-server user snmp_user_2 network-operator auth md5 0x5632724fb8ac3699296af26281e1d0f1 priv aes-128 0x5632724fb8ac3699296af26281e1d0f1 localizedkey
# snmp-server user snmp_user_1 use-ipv4acl acl1 use-ipv6acl acl2
# snmp-server user snmp_user_2 use-ipv4acl acl3 use-ipv6acl acl4
# snmp-server host 192.0.2.1 traps version 1 public
# snmp-server host 192.0.2.1 source-interface Ethernet1/1
# snmp-server host 192.0.2.2 informs version 3 auth NMS
# snmp-server community private group network-admin
# snmp-server community public group network-operator
# snmp-server enable traps aaa server-state-change
# snmp-server enable traps system Clock-change-notification
- name: Parse externally provided snmp-server configuration
cisco.nxos.nxos_snmp_server:
running_config: "{{ lookup('file', './parsed.cfg') }}"
state: parsed
# Task output (redacted)
# -----------------------
# parsed:
# aaa_user:
# cache_timeout: 36000
# communities:
# - community: private
# group: network-admin
# - community: public
# group: network-operator
# contact: nxosswitchadmin@localhost
# location: serverroom-1
# traps:
# aaa:
# server_state_change: True
# system:
# clock_change_notification: True
# hosts:
# - host: 192.0.2.1
# traps: true
# version: "1"
# community: public
#
# - host: 192.0.2.1
# source_interface: Ethernet1/1
#
# - host: 192.0.2.2
# informs: true
# version: "3"
# auth: NMS
# users:
# auth:
# - user: snmp_user_1
# group: network-operator
# authentication:
# algorithm: md5
# password: "0x5632724fb8ac3699296af26281e1d0f1"
# localized_key: True
#
# - authentication:
# algorithm: md5
# localized_key: true
# password: "0x5632724fb8ac3699296af26281e1d0f1"
# priv:
# aes_128: true
# privacy_password: "0x5632724fb8ac3699296af26281e1d0f1"
# group: network-operator
# user: snmp_user_2
#
# use_acls:
# - user: snmp_user_1
# ipv4: acl1
# ipv6: acl2
# - user: snmp_user_2
# ipv4: acl3
# ipv6: acl4
#
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: |
|
The configuration prior to the module execution. Returned: when state is Sample: |
|
The set of commands pushed to the remote device. Returned: when state is Sample: |
|
Facts about the network resource gathered from the remote device as structured data. Returned: when state is Sample: |
|
The device native config provided in running_config option parsed into structured data as per module argspec. Returned: when state is Sample: |
|
The provided configuration in the task rendered in device-native format (offline). Returned: when state is Sample: |