- Check the README
- cisco_snmp_cdp - changes cdp state globally or on an interface
- cisco_snmp_interface - configures interface settings
- cisco_snmp_portsecurity - configures interface settings
- cisco_snmp_save_config - saves the configuration.
- cisco_snmp_switchport - configures switchport settings
- cisco_snmp_vlan - create or delete vlans.
Changes CDP state globally or on an interface
- Synopsis
- Options
- Examples
Changes CDP globally, i.e. "cdp run" or "no cdp run". On a single interface the module controlls the "cdp enable" or "no cdp enable" setting. nelsnmp
Parameter | required | default | choices | comments |
---|---|---|---|---|
username | no | Username for SNMPv3, required if version is 3 | ||
level | no |
|
Authentication level, required if version is 3 | |
cdp_interface | no |
|
The mode of CDP on an individual interface | |
privacy | no |
|
Encryption algoritm, required if level is authPriv | |
community | no | The SNMP community string, required if version is 2c | ||
interface_id | no | The SNMP interface id (ifIndex) | ||
authkey | no | Authentication key, required if version is 3 | ||
host | yes | Typically set to {# inventory_hostname #} | ||
version | yes |
|
SNMP Version to use, 2c or 3 | |
cdp_global | no |
|
Global CDP mode | |
interface_name | no | The name of the interface | ||
integrity | no |
|
Hashing algoritm, required if version is 3 | |
privkey | no | Encryption key, required if version is authPriv |
# Disables CDP from running (i.e. 'no cdp run')
- cisco_snmp_cdp: host={{ inventory_hostname }} version=2c community=private cdp_global=disabled
# Enables CDP on GigabitEthernet0/1
- cisco_snmp_cdp:
host={{ inventory_hostname }}
version=3
level=authPriv
integrity=sha
privacy=aes
username=snmp-user
authkey=abc12345
privkey=def6789
interface_name=GigabitEthernet0/1
cdp_interface=enabled
# Disables CDP on GigabitEthernet0/2
- cisco_snmp_cdp:
host={{ inventory_hostname }}
version=3
level=authPriv
integrity=sha
privacy=aes
username=snmp-user
authkey=abc12345
privkey=def6789
interface_name=GigabitEthernet0/2
cdp_interface=disabled
Configures interface settings
- Synopsis
- Options
- Examples
Configured interface settings nelsnmp
Parameter | required | default | choices | comments |
---|---|---|---|---|
username | no | Username for SNMPv3, required if version is 3 | ||
description | no | The description of the interface | ||
level | no |
|
Authentication level, required if version is 3 | |
privacy | no |
|
Encryption algoritm, required if level is authPriv | |
community | no | The SNMP community string, required if version is 2c | ||
interface_id | no | The SNMP interface id (ifIndex) | ||
authkey | no | Authentication key, required if version is 3 | ||
host | yes | Typically set to {# inventory_hostname #} | ||
version | yes |
|
SNMP Version to use, 2c or 3 | |
admin_state | no |
|
Mode of the interface | |
interface_name | no | The name of the interface | ||
integrity | no |
|
Hashing algoritm, required if version is 3 | |
privkey | no | Encryption key, required if version is authPriv |
# Change description and shutdown FastEthernet0/2
- cisco_snmp_interface: host={{ inventory_hostname }} version=2c community=private interface_name=FastEthernet0/2 description="NOT IN USE" admin_state=down
# Change description and enable interface with id 10001
- cisco_snmp_interface:
host={{ inventory_hostname }}
version=3
level=authPriv
integrity=sha
privacy=aes
username=snmp-user
authkey=abc12345
privkey=def6789
interface_id=10001
description=AP1
admin_state=up
Configures interface settings
- Synopsis
- Options
- Examples
Configured interface settings nelsnmp
Parameter | required | default | choices | comments |
---|---|---|---|---|
username | no | Username for SNMPv3, required if version is 3 | ||
interface_name | no | The name of the interface | ||
portsecurity | no |
|
Mode of the interface | |
level | no |
|
Authentication level, required if version is 3 | |
violation | no |
|
Enable or disable sticky mac addresses | |
max | no | The maximum number of mac addresses | ||
privacy | no |
|
Encryption algoritm, required if level is authPriv | |
community | no | The SNMP community string, required if version is 2c | ||
sticky | no |
|
Enable or disable sticky mac addresses | |
authkey | no | Authentication key, required if version is 3 | ||
aging_type | no |
|
Set aging type | |
host | yes | Typically set to {# inventory_hostname #} | ||
version | yes |
|
SNMP Version to use, 2c or 3 | |
aging_static | no |
|
Indicates whether the secure MAC address aging mechanism is enabled on static MAC address entries | |
aging_time | no | Mac address aging time in minutes | ||
interface_id | no | The SNMP interface id (ifIndex) | ||
integrity | no |
|
Hashing algoritm, required if version is 3 | |
privkey | no | Encryption key, required if version is authPriv |
# Enable Portsecurity on FastEthernet0/2 allow 5 hosts
- cisco_snmp_portsecurity: host={{ inventory_hostname }} version=2c community=private interface_name=FastEthernet0/2 portsecurity=enabled max=5
# Disable Portsecurity on interface 10001
- cisco_snmp_portsecurity:
host={{ inventory_hostname }}
version=3
level=authPriv
integrity=sha
privacy=aes
username=snmp-user
authkey=abc12345
privkey=def6789
interface_id=10001
portsecurity=disabled
max=1
Saves the configuration.
- Synopsis
- Options
- Examples
Saves running configuration to startup configuration.
Parameter | required | default | choices | comments |
---|---|---|---|---|
username | no | Username for SNMPv3, required if version is 3 | ||
level | no |
|
Authentication level, required if version is 3 | |
privacy | no |
|
Encryption algoritm, required if level is authPriv | |
community | no | The SNMP community string, required if version is 2c | ||
authkey | no | Authentication key, required if version is 3 | ||
host | yes | Typically set to {# inventory_hostname #} | ||
version | yes |
|
SNMP Version to use, 2c or 3 | |
integrity | no |
|
Hashing algoritm, required if version is 3 | |
privkey | no | Encryption key, required if version is authPriv |
# Save configuration with SNMPv2
- cisco_snmp_save_config: host={{ inventory_hostname }} version=2c community=private
# Save configuration with SNMPv3
- cisco_snmp_save_config:
host={{ inventory_hostname }}
version=3
level=authPriv
integrity=sha
privacy=aes
username=snmp-user
authkey=abc12345
privkey=def6789
Configures switchport settings
- Synopsis
- Options
- Examples
Configured switchport setting such as port mode and vlans.
Parameter | required | default | choices | comments |
---|---|---|---|---|
username | no | Username for SNMPv3, required if version is 3 | ||
access_vlan | no | The access vlan id | ||
level | no |
|
Authentication level, required if version is 3 | |
native_vlan | no | The native vlan id on a trunk port | ||
privacy | no |
|
Encryption algoritm, required if level is authPriv | |
community | no | The SNMP community string, required if version is 2c | ||
interface_id | no | The SNMP interface id (ifIndex) | ||
authkey | no | Authentication key, required if version is 3 | ||
host | yes | Typically set to {# inventory_hostname #} | ||
version | yes |
|
SNMP Version to use, 2c or 3 | |
mode | yes |
|
Mode of the interface | |
interface_name | no | The name of the interface | ||
integrity | no |
|
Hashing algoritm, required if version is 3 | |
privkey | no | Encryption key, required if version is authPriv |
# Set interface with id 10001 to access mode in vlan 12
- cisco_snmp_switchport: host={{ inventory_hostname }} version=2c community=private interface_id=10001 mode=access access_vlan=12
# Change FastEthernet0/2 to trunk mode using native vlan 12
- cisco_snmp_switchport:
host={{ inventory_hostname }}
version=3
level=authPriv
integrity=sha
privacy=aes
username=snmp-user
authkey=abc12345
privkey=def6789
mode=trunk
interface_name="FastEthernet0/2"
native_vlan=12
Create or delete vlans.
- Synopsis
- Options
- Examples
Creates, deletes or renames VLANs on a Cisco switch using SNMP.
Parameter | required | default | choices | comments |
---|---|---|---|---|
username | no | Username for SNMPv3, required if version is 3 | ||
level | no |
|
Authentication level, required if version is 3 | |
privacy | no |
|
Encryption algoritm, required if level is authPriv | |
state | yes |
|
The desired state of the VLAN | |
community | no | The SNMP community string, required if version is 2c | ||
authkey | no | Authentication key, required if version is 3 | ||
host | yes | Typically set to {# inventory_hostname #} | ||
version | yes |
|
SNMP Version to use, 2c or 3 | |
vlan_name | no | The name of the VLAN | ||
integrity | no |
|
Hashing algoritm, required if version is 3 | |
vlan_id | yes | The VLAN number | ||
privkey | no | Encryption key, required if version is authPriv |
# Create or rename vlan 12, give it the name GUESTS
- cisco_snmp_vlan: host={{ inventory_hostname }} version=2c community=private vlan_id=12 state=present vlan_name="GUESTS"
# Delete vlan 40 if present
- cisco_snmp_vlan:
host={{ inventory_hostname }}
version=3
level=authPriv
integrity=sha
privacy=aes
username=snmp-user
authkey=abc12345
privkey=def6789
vlan_id=40
state=absent
Documentation generated with Ansible Webdocs.