Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
353 lines (279 sloc) 13.1 KB

Cisco SNMP Ansible Module Docs

Manage Cisco IOS devices with Ansible using SNMP


Requirements


Modules


cisco_snmp_cdp

Changes CDP state globally or on an interface

  • Synopsis
  • Options
  • Examples

Synopsis

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

Options

Parameter required default choices comments
username no Username for SNMPv3, required if version is 3
level no
  • authPriv
  • authNoPriv
Authentication level, required if version is 3
cdp_interface no
  • enabled
  • disabled
The mode of CDP on an individual interface
privacy no
  • des
  • 3des
  • aes
  • aes192
  • aes256
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
  • 2c
  • 3
SNMP Version to use, 2c or 3
cdp_global no
  • enabled
  • disabled
Global CDP mode
interface_name no The name of the interface
integrity no
  • md5
  • sha
Hashing algoritm, required if version is 3
privkey no Encryption key, required if version is authPriv

Examples

# 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



cisco_snmp_interface

Configures interface settings

  • Synopsis
  • Options
  • Examples

Synopsis

Configured interface settings nelsnmp

Options

Parameter required default choices comments
username no Username for SNMPv3, required if version is 3
description no The description of the interface
level no
  • authPriv
  • authNoPriv
Authentication level, required if version is 3
privacy no
  • des
  • 3des
  • aes
  • aes192
  • aes256
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
  • 2c
  • 3
SNMP Version to use, 2c or 3
admin_state no
  • up
  • down
Mode of the interface
interface_name no The name of the interface
integrity no
  • md5
  • sha
Hashing algoritm, required if version is 3
privkey no Encryption key, required if version is authPriv

Examples

# 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


cisco_snmp_portsecurity

Configures interface settings

  • Synopsis
  • Options
  • Examples

Synopsis

Configured interface settings nelsnmp

Options

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
  • enabled
  • disabled
Mode of the interface
level no
  • authPriv
  • authNoPriv
Authentication level, required if version is 3
violation no
  • shutdown
  • restrict
  • protect
Enable or disable sticky mac addresses
max no The maximum number of mac addresses
privacy no
  • des
  • 3des
  • aes
  • aes192
  • aes256
Encryption algoritm, required if level is authPriv
community no The SNMP community string, required if version is 2c
sticky no
  • enabled
  • disabled
Enable or disable sticky mac addresses
authkey no Authentication key, required if version is 3
aging_type no
  • absolute
  • inactivity
Set aging type
host yes Typically set to {# inventory_hostname #}
version yes
  • 2c
  • 3
SNMP Version to use, 2c or 3
aging_static no
  • enabled
  • disabled
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
  • md5
  • sha
Hashing algoritm, required if version is 3
privkey no Encryption key, required if version is authPriv

Examples

# 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


cisco_snmp_save_config

Saves the configuration.

  • Synopsis
  • Options
  • Examples

Synopsis

Saves running configuration to startup configuration.

Options

Parameter required default choices comments
username no Username for SNMPv3, required if version is 3
level no
  • authPriv
  • authNoPriv
Authentication level, required if version is 3
privacy no
  • des
  • 3des
  • aes
  • aes192
  • aes256
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
  • 2c
  • 3
SNMP Version to use, 2c or 3
integrity no
  • md5
  • sha
Hashing algoritm, required if version is 3
privkey no Encryption key, required if version is authPriv

Examples

# 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


cisco_snmp_switchport

Configures switchport settings

  • Synopsis
  • Options
  • Examples

Synopsis

Configured switchport setting such as port mode and vlans.

Options

Parameter required default choices comments
username no Username for SNMPv3, required if version is 3
access_vlan no The access vlan id
level no
  • authPriv
  • authNoPriv
Authentication level, required if version is 3
native_vlan no The native vlan id on a trunk port
privacy no
  • des
  • 3des
  • aes
  • aes192
  • aes256
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
  • 2c
  • 3
SNMP Version to use, 2c or 3
mode yes
  • access
  • trunk
  • desirable
  • auto
  • trunk-nonegotiate
Mode of the interface
interface_name no The name of the interface
integrity no
  • md5
  • sha
Hashing algoritm, required if version is 3
privkey no Encryption key, required if version is authPriv

Examples

# 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


cisco_snmp_vlan

Create or delete vlans.

  • Synopsis
  • Options
  • Examples

Synopsis

Creates, deletes or renames VLANs on a Cisco switch using SNMP.

Options

Parameter required default choices comments
username no Username for SNMPv3, required if version is 3
level no
  • authPriv
  • authNoPriv
Authentication level, required if version is 3
privacy no
  • des
  • 3des
  • aes
  • aes192
  • aes256
Encryption algoritm, required if level is authPriv
state yes
  • absent
  • present
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
  • 2c
  • 3
SNMP Version to use, 2c or 3
vlan_name no The name of the VLAN
integrity no
  • md5
  • sha
Hashing algoritm, required if version is 3
vlan_id yes The VLAN number
privkey no Encryption key, required if version is authPriv

Examples

# 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.