meraki_switchport – Manage switchports on a switch in the Meraki cloud

New in version 2.7.

Synopsis

  • Allows for management of switchports settings for Meraki MS switches.

Parameters

Parameter Choices/Defaults Comments
access_policy_number
-
Number of the access policy to apply.
Only applicable to access port types.
allowed_vlans
-
Default:
"all"
List of VLAN numbers to be allowed on switchport.
auth_key
string
Authentication key provided by the dashboard. Required if environmental variable MERAKI_KEY is not set.
enabled
boolean
    Choices:
  • no
  • yes ←
Whether a switchport should be enabled or disabled.
host
string
Default:
"api.meraki.com"
Hostname for Meraki dashboard.
Can be used to access regional Meraki environments, such as China.
isolation_enabled
boolean
    Choices:
  • no ←
  • yes
Isolation status of switchport.
link_negotiation
-
    Choices:
  • Auto negotiate ←
  • 100Megabit (auto)
  • 100 Megabit full duplex (forced)
Link speed for the switchport.
name
-
Switchport description.

aliases: description
number
-
Port number.
org_id
integer
ID of organization.
org_name
string
Name of organization.

aliases: organization
output_level
string
    Choices:
  • debug
  • normal ←
Set amount of debug output during module execution.
poe_enabled
boolean
    Choices:
  • no
  • yes ←
Enable or disable Power Over Ethernet on a port.
rstp_enabled
boolean
    Choices:
  • no
  • yes ←
Enable or disable Rapid Spanning Tree Protocol on a port.
serial
-
Serial nubmer of the switch.
state
-
    Choices:
  • query ←
  • present
Specifies whether a switchport should be queried or modified.
stp_guard
-
    Choices:
  • disabled ←
  • root guard
  • bpdu guard
  • loop guard
Set state of STP guard.
tags
-
Space delimited list of tags to assign to a port.
timeout
integer
Default:
30
Time to timeout for HTTP requests.
type
-
    Choices:
  • access ←
  • trunk
Set port type.
use_https
boolean
    Choices:
  • no
  • yes ←
If no, it will use HTTP. Otherwise it will use HTTPS.
Only useful for internal Meraki developers.
use_proxy
boolean
    Choices:
  • no
  • yes
If no, it will not use a proxy, even if one is defined in an environment variable on the target hosts.
validate_certs
boolean
    Choices:
  • no
  • yes ←
Whether to validate HTTP certificates.
vlan
-
VLAN number assigned to port.
If a port is of type trunk, the specified VLAN is the native VLAN.
voice_vlan
-
VLAN number assigned to a port for voice traffic.
Only applicable to access port type.

Notes

Note

Examples

- name: Query information about all switchports on a switch
  meraki_switchport:
    auth_key: abc12345
    state: query
    serial: ABC-123
  delegate_to: localhost

- name: Query information about all switchports on a switch
  meraki_switchport:
    auth_key: abc12345
    state: query
    serial: ABC-123
    number: 2
  delegate_to: localhost

- name: Name switchport
  meraki_switchport:
    auth_key: abc12345
    state: present
    serial: ABC-123
    number: 7
    name: Test Port
  delegate_to: localhost

- name: Configure access port with voice VLAN
  meraki_switchport:
    auth_key: abc12345
    state: present
    serial: ABC-123
    number: 7
    enabled: true
    name: Test Port
    tags: desktop
    type: access
    vlan: 10
    voice_vlan: 11
  delegate_to: localhost

- name: Check access port for idempotency
  meraki_switchport:
    auth_key: abc12345
    state: present
    serial: ABC-123
    number: 7
    enabled: true
    name: Test Port
    tags: desktop
    type: access
    vlan: 10
    voice_vlan: 11
  delegate_to: localhost

- name: Configure trunk port with specific VLANs
  meraki_switchport:
    auth_key: abc12345
    state: present
    serial: ABC-123
    number: 7
    enabled: true
    name: Server port
    tags: server
    type: trunk
    allowed_vlans:
      - 10
      - 15
      - 20
  delegate_to: localhost

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
data
complex
success
Information queried or updated switchports.

  accessPolicyNumber
integer
success
Number of assigned access policy. Only applicable to access ports.

Sample:
1234
  enabled
boolean
success
Enabled state of port.

Sample:
True
  isolationEnabled
boolean
success
Port isolation status of port.

Sample:
True
  linkNegotiation
string
success
Link speed for the port.

Sample:
Auto negotiate
  name
string
success
Human friendly description of port.

Sample:
Jim Phone Port
  number
integer
success
Number of port.

Sample:
1
  poeEnabled
boolean
success
Power Over Ethernet enabled state of port.

Sample:
True
  rstpEnabled
boolean
success
Enabled or disabled state of Rapid Spanning Tree Protocol (RSTP)

Sample:
True
  stpGuard
string
success
State of STP guard

Sample:
Root Guard
  tags
string
success
Space delimited list of tags assigned to port.

Sample:
phone marketing
  type
string
success
Type of switchport.

Sample:
trunk
  vlan
integer
success
VLAN assigned to port.

Sample:
10
  voiceVlan
integer
success
VLAN assigned to port with voice VLAN enabled devices.

Sample:
20


Status

Authors

  • Kevin Breit (@kbreit)

Hint

If you notice any issues in this documentation you can edit this document to improve it.