Skip to content

Latest commit

 

History

History
4143 lines (4051 loc) · 170 KB

arista.eos.eos_snmp_server_module.rst

File metadata and controls

4143 lines (4051 loc) · 170 KB

arista.eos.eos_snmp_server

Manages snmp_server resource module

Version added: 3.2.0

  • This module configures and manages the attributes of snmp_server on Arista EOS platforms.
Parameter Choices/Defaults Comments
config
dictionary
SNMP server configuration.
acls
list / elements=dictionary
ipv4/ipv6 access_lists
acl
string
acl name
afi
string
    Choices:
  • ipv4
  • ipv6
ipv4/ipv6
vrf
string
vrf name
chassis_id
string
SNMP chassis identifier.
communities
list / elements=dictionary
Community name configuration.
acl_v4
string
standard access_list name
acl_v6
string
IPv6 access list name.
name
string
Community name
ro
boolean
    Choices:
  • no
  • yes
Only reads are permitted.
rw
boolean
    Choices:
  • no
  • yes
Read_write access
view
string
MIB view name
contact
string
Person to contact about the syste,.
engineid
dictionary
SNMPv3 engine ID configuration.
local
string
Local SNMP agent
remote
dictionary
Remote SNMP agent
host
string
Hostname or IP address of remote SNMP notification host
id
string
engine ID octet string
udp_port
integer
The remote SNMP notification host's UDP port number.
extension
dictionary
Configure extension script to serve an OID range
oneshot
boolean
    Choices:
  • no
  • yes
Use inefficient one_shot interface
root_oid
string
Extension root oid
script_location
string
script location
groups
list / elements=dictionary
SNMP USM group
auth_privacy
string
    Choices:
  • auth
  • noauth
  • priv
auth and privacy config. Valid when version = v3.
context
string
Specify a context to associate with the group
group
string
SNMP group for the user
notify
string
View to restrict notifications
read
string
View to restrict read access
version
string
    Choices:
  • v1
  • v3
  • v2c
snmp security group version
write
string
View to restrict write access
hosts
list / elements=dictionary
Notification destinations
host
string
Hostname or IP address of SNMP notification host.
informs
boolean
    Choices:
  • no
  • yes
Use SNMP inform messages.
traps
boolean
    Choices:
  • no
  • yes
Use SNMP trap messages
udp_port
integer
UDP destination port for notification messages.
user
string
Community or user name.
version
string
    Choices:
  • 1
  • 2c
  • 3 auth
  • 3 noauth
  • 3 priv
Notification message SNMP version.
vrf
string
Specify the VRF in which the host is configured
local_interface
string
Configure the source interface for SNMP notifications.
location
string
The sysLocation string.
notification
integer
Maximum number of notifications in the log
objects
dictionary
when true Disable implementation of a group of objects
mac_address_tables
boolean
    Choices:
  • no
  • yes
dot1dTpFdbTable, dot1qTpFdbTable
route_tables
boolean
    Choices:
  • no
  • yes
ipCidrRouteTable, ipCidrRouteNumber, aristaFIBStats*
qos
integer
Configure QoS parameters.
qosmib
integer
Set QOS_MIB counter update interval
transmit
integer
Maximum number of bytes in SNMP message (UDP/TCP payload)
transport
string
Enable snmpd transport layer protocol
traps
dictionary
Enable traps to all configured recipients.
bgp
dictionary
Enable Bgp traps. If set to enabled , all the traps are set.
arista_backward_transition
boolean
    Choices:
  • no
  • yes
arista_backward_transition
arista_established
boolean
    Choices:
  • no
  • yes
arista_established
backward_transition
boolean
    Choices:
  • no
  • yes
backward_transition
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
established
boolean
    Choices:
  • no
  • yes
established.
bridge
dictionary
Enable Bridge traps. If set to enabled , all the traps are set.
arista_mac_age
boolean
    Choices:
  • no
  • yes
arista_mac_age
arista_mac_learn
boolean
    Choices:
  • no
  • yes
arista_mac_learn
arista_mac_move
boolean
    Choices:
  • no
  • yes
arista_mac_move
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
capacity
dictionary
Enable Capacity traps. If set to enabled , all the traps are set.
arista_hardware_utilization_alert
boolean
    Choices:
  • no
  • yes
arista_hardware_utilization_alert
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
entity
dictionary
Enable Entity traps. If set to enabled , all the traps are set.
arista_ent_sensor_alarm
boolean
    Choices:
  • no
  • yes
arista_ent_sensor_alarm
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
ent_config_change
boolean
    Choices:
  • no
  • yes
ent_config_change
ent_state_oper
boolean
    Choices:
  • no
  • yes
ent_state_oper
ent_state_oper_disabled
boolean
    Choices:
  • no
  • yes
ent_state_oper_disabled.
ent_state_oper_enabled
boolean
    Choices:
  • no
  • yes
ent_state_oper_enabled.
external_alarm
dictionary
Enable external alarm traps. If set to enabled , all the traps are set.
arista_external_alarm_asserted_notif
boolean
    Choices:
  • no
  • yes
arista_external_alarm_asserted_notif
arista_external_alarm_deasserted_notif
boolean
    Choices:
  • no
  • yes
arista_external_alarm_deasserted_notif
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
isis
dictionary
Enable isis traps. If set to enabled , all the traps are set.
adjacency_change
boolean
    Choices:
  • no
  • yes
adjacency_change
area_mismatch
boolean
    Choices:
  • no
  • yes
area_mismatch
attempt_to_exceed_max_sequence
boolean
    Choices:
  • no
  • yes
attempt_to_exceed_max_sequence
authentication_type_failure
boolean
    Choices:
  • no
  • yes
authentication_type_failure.
database_overload
boolean
    Choices:
  • no
  • yes
database_overload
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
own_lsp_purge
boolean
    Choices:
  • no
  • yes
own_lsp_purge
rejected_adjacency
boolean
    Choices:
  • no
  • yes
rejected_adjacency
sequence_number_skip
boolean
    Choices:
  • no
  • yes
sequence_number_skip.
lldp
dictionary
Enable Lldp traps. If set to enabled , all the traps are set.
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
rem_tables_change
boolean
    Choices:
  • no
  • yes
rem_tables_change
mpls_ldp
dictionary
Enable mpls_ldp traps. If set to enabled , all the traps are set.
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
mpls_ldp_session_down
boolean
    Choices:
  • no
  • yes
mpls_ldp_session_down
mpls_ldp_session_up
boolean
    Choices:
  • no
  • yes
mpls_ldp_session_up
msdp
dictionary
Enable msdp traps. If set to enabled , all the traps are set.
backward_transition
boolean
    Choices:
  • no
  • yes
backward_transition.
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
established
boolean
    Choices:
  • no
  • yes
established.
ospf
dictionary
Enable Ospf traps. If set to enabled , all the traps are set.
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
if_auth_failure
boolean
    Choices:
  • no
  • yes
if_auth_failure
if_config_error
boolean
    Choices:
  • no
  • yes
if_config_error
if_state_change
boolean
    Choices:
  • no
  • yes
if_state_change
nbr_state_change
boolean
    Choices:
  • no
  • yes
nbr_state_change.
ospfv3
dictionary
Enable Ospfv3 traps. If set to enabled , all the traps are set.
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
if_config_error
boolean
    Choices:
  • no
  • yes
if_config_error
if_rx_bad_packet
boolean
    Choices:
  • no
  • yes
if_rx_bad_packet
if_state_change
boolean
    Choices:
  • no
  • yes
if_state_change
nbr_restart_helper_status_change
boolean
    Choices:
  • no
  • yes
Enable ospfv3NbrRestartHelperStatusChange trap
nbr_state_change
boolean
    Choices:
  • no
  • yes
nbr_state_change.
nssa_translator_status_change
boolean
    Choices:
  • no
  • yes
Enable ospfv3NssaTranslatorStatusChange trap
restart_status_change
boolean
    Choices:
  • no
  • yes
restart_status_change
pim
dictionary
Enable Pim traps. If set to enabled , all the traps are set.
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
neighbor_loss
boolean
    Choices:
  • no
  • yes
neighbor_loss
snmp
dictionary
Enable snmp traps. If set to enabled , all the traps are set.
authentication
boolean
    Choices:
  • no
  • yes
authentication
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
link_down
boolean
    Choices:
  • no
  • yes
link_down
link_up
boolean
    Choices:
  • no
  • yes
link_up
snmpConfigManEvent
dictionary
Enable snmpConfigManEvent traps. If set to enabled , all the traps are set.
arista_config_man_event
boolean
    Choices:
  • no
  • yes
arista_config_man_event
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
switchover
dictionary
Enable switchover traps. If set to enabled , all the traps are set.
arista_redundancy_switch_over_notif
boolean
    Choices:
  • no
  • yes
arista_redundancy_switch_over_notif
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
test
dictionary
Enable test traps. If set to enabled , all the traps are set.
arista_test_notification
boolean
    Choices:
  • no
  • yes
arista_test_notification
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
vrrp
dictionary
Enable vrrp traps. If set to enabled , all the traps are set.
enabled
boolean
    Choices:
  • no
  • yes
All traps are set.
trap_new_master
boolean
    Choices:
  • no
  • yes
vrrp
users
list / elements=dictionary
SNMP user configuration.
auth
dictionary
User authentication settings
algorithm
string
algorithm for authentication
auth_passphrase
string
authentication passphrase hex string
encryption
string
algorithm for encryption.
priv_passphrase
string
privacy passphrase hexstring
group
string
SNMP group for the user.
localized
dictionary
localized auth and privacy passphrases.
algorithm
string
algorithm for authentication
auth_passphrase
string
authentication passphrase hex string
encryption
string
algorithm for encryption.
engineid
string
Engine id
priv_passphrase
string
privacy passphrase hexstring
remote
string
System where an SNMPv3 user is hosted
udp_port
integer
UDP port used by the remote SNMP system
user
string
SNMP user name
version
string
    Choices:
  • v1
  • v2c
  • v3
snmp security version
views
list / elements=dictionary
SNMPv2 MIB view configuration
action
string
    Choices:
  • excluded
  • included
Action to be performed.
mib
string
SNMP MIB name
view
string
SNMP view name
vrfs
list / elements=dictionary
Specify the VRF in which the source address is used
local_interface
string
Configure the source interface for SNMP notifications
vrf
string
vrf name.
running_config
string
This option is used only with state parsed.
The value of this option should be the output received from the EOS device by executing the command show running_config | section snmp_server.
The state parsed reads the configuration from 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 parsed key within the result.
state
string
    Choices:
  • deleted
  • merged ←
  • overridden
  • replaced
  • gathered
  • rendered
  • parsed
The state the configuration should be left in.
The states replaced and overridden have identical behaviour for this module.
Please refer to examples for more details.

Note

  • Tested against Arista EOS 4.24.6F
  • This module works with connection network_cli and httpapi.
# 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:

Key Returned Description
after
dictionary
when changed
The resulting configuration after module execution.

Sample:
This output will always be in the same format as the module argspec.
before
dictionary
when state is merged, replaced, overridden, deleted or purged
The configuration prior to the module execution.

Sample:
This output will always be in the same format as the module argspec.
commands
list
when state is merged, replaced, overridden, deleted or purged
The set of commands pushed to the remote device.

Sample:
['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']
gathered
list
when state is gathered
Facts about the network resource gathered from the remote device as structured data.

Sample:
This output will always be in the same format as the module argspec.
parsed
list
when state is parsed
The device native config provided in running_config option parsed into structured data as per module argspec.

Sample:
This output will always be in the same format as the module argspec.
rendered
list
when state is rendered
The provided configuration in the task rendered in device-native format (offline).

Sample:
['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']


Authors

  • Gomathi Selvi Srinivasan (@GomathiselviS)