Manages snmp_server resource module
Version added: 3.2.0
- This module configures and manages the attributes of snmp_server on Arista EOS platforms.
Note
- Tested against Arista EOS 4.24.6F
- This module works with connection
network_cli
andhttpapi
.
# 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"
# }
# ]
# },
Common return values are documented here, the following are the fields unique to this module:
- Gomathi Selvi Srinivasan (@GomathiselviS)