eos_snmp_server¶
Collection Note
This module is part of the arista.eos collection. To install the collection, use:
Added in version3.2.0.
Synopsis¶
- This module configures and manages the attributes of snmp_server on Arista EOS platforms.
Parameters¶
| Parameter | Defaults / Choices | Comments |
|---|---|---|
| config dict |
SNMP server configuration. | |
| config.acls | ipv4/ipv6 access_lists | |
| config.chassis_id | SNMP chassis identifier. | |
| config.communities | Community name configuration. | |
| config.contact | Person to contact about the syste,. | |
| config.engineid | SNMPv3 engine ID configuration. | |
| config.extension | Configure extension script to serve an OID range | |
| config.groups | SNMP USM group | |
| config.hosts | Notification destinations | |
| config.local_interface | Configure the source interface for SNMP notifications. | |
| config.location | The sysLocation string. | |
| config.notification | Maximum number of notifications in the log | |
| config.objects | when true Disable implementation of a group of objects | |
| config.qos | Configure QoS parameters. | |
| config.qosmib | Set QOS_MIB counter update interval | |
| config.transmit | Maximum number of bytes in SNMP message (UDP/TCP payload) | |
| config.transport | Enable snmpd transport layer protocol | |
| config.traps | Enable traps to all configured recipients. | |
| config.users | SNMP user configuration. | |
| config.views | SNMPv2 MIB view configuration | |
| config.vrfs | Specify the VRF in which the source address is used | |
| running_config str |
This option is used only with state I(parsed). The value of this option should be the output received from the EOS device by executing the command B(show running_config | section snmp_server). The state I(parsed) reads the configuration from C(running_config) option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the I(parsed) key within the result. |
|
| state str |
Default: merged Choices: deleted, merged, overridden, replaced, gathered, rendered, parsed |
The state the configuration should be left in. The states I(replaced) and I(overridden) have identical behaviour for this module. Please refer to examples for more details. |
Notes¶
Note
- Tested against Arista EOS 4.24.6F
- This module works with connection C(network_cli) and C(httpapi).
Examples¶
# Using merged:
# Before State
# eos#show running-config | section snmp-server
# eos#
- name: merge given snmp_server configuration
arista.eos.eos_snmp_server:
config:
communities:
- name: "comm3"
acl_v6: "list1"
view: "view1"
- name: "comm4"
acl_v4: "list3"
view: "view1"
- name: "comm5"
acl_v4: "list4"
ro: true
contact: "admin"
engineid:
remote:
host: 1.1.1.1
id: "1234567"
groups:
- group: "group1"
version: "v1"
read: "view1"
- group: "group2"
version: "v3"
auth_privacy: "priv"
notify: "view1"
write: "view2"
hosts:
- host: "host02"
user: "user01"
udp_port: 23
version: "2c"
- host: "host01"
user: "user01"
udp_port: 23
version: "3 priv"
traps:
capacity:
arista_hardware_utilization_alert: true
bgp:
enabled: true
external_alarm:
arista_external_alarm_deasserted_notif: true
arista_external_alarm_asserted_notif: true
vrfs:
- vrf: "vrf01"
local_interface: "Ethernet1"
# After state
# eos#show running-config | section snmp-server
# snmp-server community comm3 view view1 ipv6 list1
# snmp-server community comm4 view view1 list3
# snmp-server community comm5 ro list4
# snmp-server group group1 v1 read view1
# snmp-server group group2 v3 priv write view2 notify view1
# snmp-server host host02 version 2c user01 udp-port 23
# snmp-server host host01 version 3 priv user01 udp-port 23
# snmp-server vrf vrf01 local-interface Ethernet1
# snmp-server contact admin
# snmp-server enable traps bgp
# snmp-server enable traps capacity arista-hardware-utilization-alert
# snmp-server enable traps external-alarm arista-external-alarm-asserted-notif arista-external-alarm-deasserted-notif
#
# Module Execution
#
# "after": {
# "communities": [
# {
# "acl_v6": "list1",
# "name": "comm3",
# "ro": true,
# "view": "view1"
# },
# {
# "acl_v4": "list3",
# "name": "comm4",
# "ro": true,
# "view": "view1"
# },
# {
# "acl_v4": "list4",
# "name": "comm5",
# "ro": true
# }
# ],
# "contact": "admin",
# "groups": [
# {
# "group": "group1",
# "read": "view1",
# "version": "v1"
# },
# {
# "auth_privacy": "priv",
# "group": "group2",
# "notify": "view1",
# "version": "v3",
# "write": "view2"
# }
# ],
# "hosts": [
# {
# "host": "host01",
# "udp_port": 23,
# "user": "user01",
# "version": "3 priv"
# },
# {
# "host": "host02",
# "udp_port": 23,
# "user": "user01",
# "version": "2c"
# }
# ],
# "traps": {
# "bgp": {
# "enabled": true
# },
# "capacity": {
# "arista_hardware_utilization_alert": true
# },
# "external_alarm": {
# "arista_external_alarm_asserted_notif": true,
# "arista_external_alarm_deasserted_notif": true
# }
# },
# "vrfs": [
# {
# "local_interface": "Ethernet1",
# "vrf": "vrf01"
# }
# ]
# },
# "before": {},
# "changed": true,
# "commands": [
# "snmp-server community comm3 view view1 ipv6 list1",
# "snmp-server community comm4 view view1 list3",
# "snmp-server community comm5 ro list4",
# "snmp-server group group1 v1 read view1",
# "snmp-server group group2 v3 priv write view2 notify view1",
# "snmp-server host host02 version 2c user01 udp-port 23",
# "snmp-server host host01 version 3 priv user01 udp-port 23",
# "snmp-server vrf vrf01 local-interface Ethernet1",
# "snmp-server contact admin",
# "snmp-server engineID remote 1.1.1.1 1234567",
# "snmp-server enable traps bgp",
# "snmp-server enable traps capacity arista-hardware-utilization-alert",
# "snmp-server enable traps external-alarm arista-external-alarm-asserted-notif arista-external-alarm-deasserted-notif"
# ],
#
# Using replaced:
# Before State:
# eos#show running-config | section snmp-server
# snmp-server community comm3 view view1 ipv6 list1
# snmp-server community comm4 view view1 list3
# snmp-server community comm5 ro list4
# snmp-server group group1 v1 read view1
# snmp-server group group2 v3 priv write view2 notify view1
# snmp-server host host02 version 2c user01 udp-port 23
# snmp-server host host01 version 3 priv user01 udp-port 23
# snmp-server vrf vrf01 local-interface Ethernet1
# snmp-server contact admin
# snmp-server enable traps bgp
# snmp-server enable traps capacity arista-hardware-utilization-alert
# snmp-server enable traps external-alarm arista-external-alarm-asserted-notif arista-external-alarm-deasserted-notif
- name: Replace given snmp_server configuration
become: true
register: result
arista.eos.eos_snmp_server: &replaced
state: replaced
config:
communities:
- name: "comm3"
acl_v6: "list1"
view: "view1"
- name: "replacecomm"
acl_v4: "list4"
extension:
root_oid: "123456"
script_location: "flash:"
traps:
test:
arista_test_notification: true
bgp:
enabled: true
vrfs:
- vrf: "vrf_replace"
local_interface: "Ethernet1"
# After State:
# eos#show running-config | section snmp-server
# snmp-server community comm3 view view1 ipv6 list1
# snmp-server community replacecomm list4
# snmp-server vrf vrf_replace local-interface Ethernet1
# snmp-server extension 123456 flash:
# snmp-server enable traps test arista-test-notification
# snmp-server enable traps bgp
# Module Execution:
# "after": {
# "communities": [
# {
# "acl_v6": "list1",
# "name": "comm3",
# "ro": true,
# "view": "view1"
# },
# {
# "acl_v4": "list4",
# "name": "replacecomm",
# "ro": true
# }
# ],
# "extension": {
# "root_oid": "0.123456",
# "script_location": "flash:"
# },
# "traps": {
# "bgp": {
# "enabled": true
# },
# "test": {
# "arista_test_notification": true
# }
# },
# "vrfs": [
# {
# "local_interface": "Ethernet1",
# "vrf": "vrf_replace"
# }
# ]
# },
# "before": {
# "communities": [
# {
# "acl_v6": "list1",
# "name": "comm3",
# "ro": true,
# "view": "view1"
# },
# {
# "acl_v4": "list3",
# "name": "comm4",
# "ro": true,
# "view": "view1"
# },
# {
# "acl_v4": "list4",
# "name": "comm5",
# "ro": true
# }
# ],
# "contact": "admin",
# "groups": [
# {
# "group": "group1",
# "read": "view1",
# "version": "v1"
# },
# {
# "auth_privacy": "priv",
# "group": "group2",
# "notify": "view1",
# "version": "v3",
# "write": "view2"
# }
# ],
# "hosts": [
# {
# "host": "host01",
# "udp_port": 23,
# "user": "user01",
# "version": "3 priv"
# },
# {
# "host": "host02",
# "udp_port": 23,
# "user": "user01",
# "version": "2c"
# }
# ],
# "traps": {
# "bgp": {
# "enabled": true
# },
# "capacity": {
# "arista_hardware_utilization_alert": true
# },
# "external_alarm": {
# "arista_external_alarm_asserted_notif": true,
# "arista_external_alarm_deasserted_notif": true
# }
# },
# "vrfs": [
# {
# "local_interface": "Ethernet1",
# "vrf": "vrf01"
# }
# ]
# },
# "changed": true,
# "commands": [
# "snmp-server community comm3 view view1 ipv6 list1",
# "snmp-server community replacecomm list4",
# "no snmp-server community comm4 view view1 ro list3",
# "no snmp-server community comm5 ro list4",
# "no snmp-server group group1 v1 read view1",
# "no snmp-server group group2 v3 priv write view2 notify view1",
# "no snmp-server host host01 version 3 priv user01 udp-port 23",
# "no snmp-server host host02 version 2c user01 udp-port 23",
# "snmp-server vrf vrf_replace local-interface Ethernet1",
# "no snmp-server vrf vrf01 local-interface Ethernet1",
# "snmp-server extension 123456 flash:",
# "default snmp-server enable traps capacity arista-hardware-utilization-alert",
# "default snmp-server enable traps external-alarm arista-external-alarm-asserted-notif arista-external-alarm-deasserted-notif",
# "snmp-server enable traps test arista-test-notification",
# "no snmp-server contact admin"
# ],
# Using overridden:
# Before State:
# eos#show running-config | section snmp-server
# snmp-server community comm3 view view1 ipv6 list1
# snmp-server community comm4 view view1 list3
# snmp-server community comm5 ro list4
# snmp-server group group1 v1 read view1
# snmp-server group group2 v3 priv write view2 notify view1
# snmp-server host host02 version 2c user01 udp-port 23
# snmp-server host host01 version 3 priv user01 udp-port 23
# snmp-server vrf vrf01 local-interface Ethernet1
# snmp-server contact admin
# snmp-server enable traps bgp
# snmp-server enable traps capacity arista-hardware-utilization-alert
# snmp-server enable traps external-alarm arista-external-alarm-asserted-notif arista-external-alarm-deasserted-notif
- name: Override given snmp_server configuration
arista.eos.eos_snmp_server:
state: overridden
config:
communities:
- name: "comm3"
acl_v6: "list1"
view: "view1"
- name: "replacecomm"
acl_v4: "list4"
extension:
root_oid: "123456"
script_location: "flash:"
traps:
test:
arista_test_notification: true
bgp:
enabled: true
vrfs:
- vrf: "vrf_replace"
local_interface: "Ethernet1"
# After State:
# eos#show running-config | section snmp-server
# snmp-server community comm3 view view1 ipv6 list1
# snmp-server community replacecomm list4
# snmp-server vrf vrf_replace local-interface Ethernet1
# snmp-server extension 123456 flash:
# snmp-server enable traps test arista-test-notification
# snmp-server enable traps bgp
# Module Execution:
# "after": {
# "communities": [
# {
# "acl_v6": "list1",
# "name": "comm3",
# "ro": true,
# "view": "view1"
# },
# {
# "acl_v4": "list4",
# "name": "replacecomm",
# "ro": true
# }
# ],
# "extension": {
# "root_oid": "0.123456",
# "script_location": "flash:"
# },
# "traps": {
# "bgp": {
# "enabled": true
# },
# "test": {
# "arista_test_notification": true
# }
# },
# "vrfs": [
# {
# "local_interface": "Ethernet1",
# "vrf": "vrf_replace"
# }
# ]
# },
# "before": {
# "communities": [
# {
# "acl_v6": "list1",
# "name": "comm3",
# "ro": true,
# "view": "view1"
# },
# {
# "acl_v4": "list3",
# "name": "comm4",
# "ro": true,
# "view": "view1"
# },
# {
# "acl_v4": "list4",
# "name": "comm5",
# "ro": true
# }
# ],
# "contact": "admin",
# "groups": [
# {
# "group": "group1",
# "read": "view1",
# "version": "v1"
# },
# {
# "auth_privacy": "priv",
# "group": "group2",
# "notify": "view1",
# "version": "v3",
# "write": "view2"
# }
# ],
# "hosts": [
# {
# "host": "host01",
# "udp_port": 23,
# "user": "user01",
# "version": "3 priv"
# },
# {
# "host": "host02",
# "udp_port": 23,
# "user": "user01",
# "version": "2c"
# }
# ],
# "traps": {
# "bgp": {
# "enabled": true
# },
# "capacity": {
# "arista_hardware_utilization_alert": true
# },
# "external_alarm": {
# "arista_external_alarm_asserted_notif": true,
# "arista_external_alarm_deasserted_notif": true
# }
# },
# "vrfs": [
# {
# "local_interface": "Ethernet1",
# "vrf": "vrf01"
# }
# ]
# },
# "changed": true,
# "commands": [
# "snmp-server community comm3 view view1 ipv6 list1",
# "snmp-server community replacecomm list4",
# "no snmp-server community comm4 view view1 ro list3",
# "no snmp-server community comm5 ro list4",
# "no snmp-server group group1 v1 read view1",
# "no snmp-server group group2 v3 priv write view2 notify view1",
# "no snmp-server host host01 version 3 priv user01 udp-port 23",
# "no snmp-server host host02 version 2c user01 udp-port 23",
# "snmp-server vrf vrf_replace local-interface Ethernet1",
# "no snmp-server vrf vrf01 local-interface Ethernet1",
# "snmp-server extension 123456 flash:",
# "default snmp-server enable traps capacity arista-hardware-utilization-alert",
# "default snmp-server enable traps external-alarm arista-external-alarm-asserted-notif arista-external-alarm-deasserted-notif",
# "snmp-server enable traps test arista-test-notification",
# "no snmp-server contact admin"
# ],
# Using deleted:
# Before State:
# eos#show running-config | section snmp-server
# snmp-server community comm3 view view1 ipv6 list1
# snmp-server community comm4 view view1 list3
# snmp-server community comm5 ro list4
# snmp-server group group1 v1 read view1
# snmp-server group group2 v3 priv write view2 notify view1
# snmp-server host host02 version 2c user01 udp-port 23
# snmp-server host host01 version 3 priv user01 udp-port 23
# snmp-server vrf vrf01 local-interface Ethernet1
# snmp-server contact admin
# snmp-server enable traps bgp
# snmp-server enable traps capacity arista-hardware-utilization-alert
# snmp-server enable traps external-alarm arista-external-alarm-asserted-notif arista-external-alarm-deasserted-notif
- name: Delete given snmp_server configuration
arista.eos.eos_snmp_server:
state: deleted
# After State:
# eos#show running-config | section snmp-server
#
# Module Execution:
# "after": {},
# "before": {
# "communities": [
# {
# "acl_v6": "list1",
# "name": "comm3",
# "ro": true,
# "view": "view1"
# },
# {
# "acl_v4": "list3",
# "name": "comm4",
# "ro": true,
# "view": "view1"
# },
# {
# "acl_v4": "list4",
# "name": "comm5",
# "ro": true
# }
# ],
# "contact": "admin",
# "groups": [
# {
# "group": "group1",
# "read": "view1",
# "version": "v1"
# },
# {
# "auth_privacy": "priv",
# "group": "group2",
# "notify": "view1",
# "version": "v3",
# "write": "view2"
# }
# ],
# "hosts": [
# {
# "host": "host01",
# "udp_port": 23,
# "user": "user01",
# "version": "3 priv"
# },
# {
# "host": "host02",
# "udp_port": 23,
# "user": "user01",
# "version": "2c"
# }
# ],
# "traps": {
# "bgp": {
# "enabled": true
# },
# "capacity": {
# "arista_hardware_utilization_alert": true
# },
# "external_alarm": {
# "arista_external_alarm_asserted_notif": true,
# "arista_external_alarm_deasserted_notif": true
# }
# },
# "vrfs": [
# {
# "local_interface": "Ethernet1",
# "vrf": "vrf01"
# }
# ]
# },
# "changed": true,
# "commands": [
# "no snmp-server community comm3 view view1 ro ipv6 list1",
# "no snmp-server community comm4 view view1 ro list3",
# "no snmp-server community comm5 ro list4",
# "no snmp-server group group1 v1 read view1",
# "no snmp-server group group2 v3 priv write view2 notify view1",
# "no snmp-server host host01 version 3 priv user01 udp-port 23",
# "no snmp-server host host02 version 2c user01 udp-port 23",
# "no snmp-server vrf vrf01 local-interface Ethernet1",
# "no snmp-server contact admin",
# "default snmp-server enable traps bgp",
# "default snmp-server enable traps capacity arista-hardware-utilization-alert",
# "default snmp-server enable traps external-alarm arista-external-alarm-asserted-notif arista-external-alarm-deasserted-notif"
# ],
#
# Using parsed:
# _parsed.cfg
# snmp-server contact admin
# snmp-server vrf vrf01 local-interface Ethernet1
# snmp-server community comm3 view view1 ro ipv6 list1
# snmp-server community comm4 view view1 ro list3
# snmp-server community comm5 ro list4
# snmp-server group group1 v1 read view1
# snmp-server group group2 v3 priv write view2 notify view1
# snmp-server host host01 version 3 priv user01 udp-port 23
# snmp-server host host02 version 2c user01 udp-port 23
# snmp-server enable traps bgp
# snmp-server enable traps capacity arista-hardware-utilization-alert
# snmp-server enable traps external-alarm arista-external-alarm-asserted-notif
# snmp-server enable traps external-alarm arista-external-alarm-deasserted-notif
- name: Provide the running configuration for parsing (config to be parsed)
arista.eos.eos_snmp_server:
running_config: "{{ lookup('file', '_parsed.cfg') }}"
state: parsed
# Module Execution:
# "parsed": {
# "communities": [
# {
# "acl_v6": "list1",
# "name": "comm3",
# "ro": true,
# "view": "view1"
# },
# {
# "acl_v4": "list3",
# "name": "comm4",
# "ro": true,
# "view": "view1"
# },
# {
# "acl_v4": "list4",
# "name": "comm5",
# "ro": true
# }
# ],
# "contact": "admin",
# "groups": [
# {
# "group": "group1",
# "read": "view1",
# "version": "v1"
# },
# {
# "auth_privacy": "priv",
# "group": "group2",
# "notify": "view1",
# "version": "v3",
# "write": "view2"
# }
# ],
# "hosts": [
# {
# "host": "host01",
# "udp_port": 23,
# "user": "user01",
# "version": "3 priv"
# },
# {
# "host": "host02",
# "udp_port": 23,
# "user": "user01",
# "version": "2c"
# }
# ],
# "traps": {
# "bgp": {
# "enabled": true
# },
# "capacity": {
# "arista_hardware_utilization_alert": true
# },
# "external_alarm": {
# "arista_external_alarm_asserted_notif": true,
# "arista_external_alarm_deasserted_notif": true
# }
# },
# "vrfs": [
# {
# "local_interface": "Ethernet1",
# "vrf": "vrf01"
# }
# ]
# }
# Using rendered:
- name: Render given snmp_server configuration
arista.eos.eos_snmp_server:
state: "rendered"
config:
communities:
- name: "comm3"
acl_v6: "list1"
view: "view1"
- name: "comm4"
acl_v4: "list3"
view: "view1"
- name: "comm5"
acl_v4: "list4"
ro: true
contact: "admin"
engineid:
remote:
host: 1.1.1.1
id: "1234567"
groups:
- group: "group1"
version: "v1"
read: "view1"
- group: "group2"
version: "v3"
auth_privacy: "priv"
notify: "view1"
write: "view2"
hosts:
- host: "host02"
user: "user01"
udp_port: 23
version: "2c"
- host: "host01"
user: "user01"
udp_port: 23
version: "3 priv"
traps:
capacity:
arista_hardware_utilization_alert: true
bgp:
enabled: true
external_alarm:
arista_external_alarm_deasserted_notif: true
arista_external_alarm_asserted_notif: true
vrfs:
- vrf: "vrf01"
local_interface: "Ethernet1"
# Module Execution:
# "rendered": [
# "snmp-server community comm3 view view1 ipv6 list1",
# "snmp-server community comm4 view view1 list3",
# "snmp-server community comm5 ro list4",
# "snmp-server group group1 v1 read view1",
# "snmp-server group group2 v3 priv write view2 notify view1",
# "snmp-server host host02 version 2c user01 udp-port 23",
# "snmp-server host host01 version 3 priv user01 udp-port 23",
# "snmp-server vrf vrf01 local-interface Ethernet1",
# "snmp-server contact admin",
# "snmp-server engineID remote 1.1.1.1 1234567",
# "snmp-server enable traps bgp",
# "snmp-server enable traps capacity arista-hardware-utilization-alert",
# "snmp-server enable traps external-alarm arista-external-alarm-asserted-notif arista-external-alarm-deasserted-notif"
# ]
# using gathered:
# eos#show running-config | section snmp-server
# snmp-server community comm3 view view1 ipv6 list1
# snmp-server community comm4 view view1 list3
# snmp-server community comm5 ro list4
# snmp-server group group1 v1 read view1
# snmp-server group group2 v3 priv write view2 notify view1
# snmp-server host host02 version 2c user01 udp-port 23
# snmp-server host host01 version 3 priv user01 udp-port 23
# snmp-server vrf vrf01 local-interface Ethernet1
# snmp-server contact admin
# snmp-server enable traps bgp
# snmp-server enable traps capacity arista-hardware-utilization-alert
# snmp-server enable traps external-alarm arista-external-alarm-asserted-notif arista-external-alarm-deasserted-notif
- name: Gathered the provided configuration with the exisiting running configuration
arista.eos.eos_snmp_server:
config:
state: gathered
# Module Execution:
# "gathered": {
# "communities": [
# {
# "acl_v6": "list1",
# "name": "comm3",
# "ro": true,
# "view": "view1"
# },
# {
# "acl_v4": "list3",
# "name": "comm4",
# "ro": true,
# "view": "view1"
# },
# {
# "acl_v4": "list4",
# "name": "comm5",
# "ro": true
# }
# ],
# "contact": "admin",
# "groups": [
# {
# "group": "group1",
# "read": "view1",
# "version": "v1"
# },
# {
# "auth_privacy": "priv",
# "group": "group2",
# "notify": "view1",
# "version": "v3",
# "write": "view2"
# }
# ],
# "hosts": [
# {
# "host": "host01",
# "udp_port": 23,
# "user": "user01",
# "version": "3 priv"
# },
# {
# "host": "host02",
# "udp_port": 23,
# "user": "user01",
# "version": "2c"
# }
# ],
# "traps": {
# "bgp": {
# "enabled": true
# },
# "capacity": {
# "arista_hardware_utilization_alert": true
# },
# "external_alarm": {
# "arista_external_alarm_asserted_notif": true,
# "arista_external_alarm_deasserted_notif": true
# }
# },
# "vrfs": [
# {
# "local_interface": "Ethernet1",
# "vrf": "vrf01"
# }
# ]
# },
Return Values¶
| Key | Data Type | Description | Returned |
|---|---|---|---|
| after | dict | The resulting configuration after module execution. | when changed |
| before | dict | The configuration prior to the module execution. | when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) |
| commands | list | The set of commands pushed to the remote device. | when I(state) is C(merged), C(replaced), C(overridden), C(deleted) or C(purged) |
| gathered | list | Facts about the network resource gathered from the remote device as structured data. | when I(state) is C(gathered) |
| parsed | list | The device native config provided in I(running_config) option parsed into structured data as per module argspec. | when I(state) is C(parsed) |
| rendered | list | The provided configuration in the task rendered in device-native format (offline). | when I(state) is C(rendered) |
Authors¶
- Gomathi Selvi Srinivasan (@gomathiselvis)