cisco.meraki.meraki_ms_switchport – Manage switchports on a switch in the Meraki cloud
cisco.meraki.meraki_ms_switchport – Manage switchports on a switch in the Meraki cloud
Note
This plugin is part of the cisco.meraki collection (version 2.1.3).
To install it use: ansible-galaxy collection install cisco.meraki
.
To use it in a playbook, specify: cisco.meraki.meraki_ms_switchport
.
Synopsis
- Allows for management of switchports settings for Meraki MS switches.
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
access_policy_number integer |
Number of the access policy to apply. Only applicable to access port types. | |
access_policy_type string |
|
Type of access policy to apply to port. |
allowed_vlans list / elements=string |
Default: "all" |
List of VLAN numbers to be allowed on switchport. |
auth_key string / required |
Authentication key provided by the dashboard. Required if environmental variable | |
enabled boolean |
|
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. |
internal_error_retry_time integer |
Default: 60 |
Number of seconds to retry if server returns an internal server error. |
isolation_enabled boolean |
|
Isolation status of switchport. |
link_negotiation string |
|
Link speed for the switchport. |
name string |
Switchport description.
| |
number string |
Port number. | |
org_id string |
ID of organization. | |
org_name string |
Name of organization.
| |
output_format string |
|
Instructs module whether response keys should be snake case (ex. |
output_level string |
|
Set amount of debug output during module execution. |
poe_enabled boolean |
|
Enable or disable Power Over Ethernet on a port. |
rate_limit_retry_time integer |
Default: 165 |
Number of seconds to retry if rate limiter is triggered. |
rstp_enabled boolean |
|
Enable or disable Rapid Spanning Tree Protocol on a port. |
serial string / required |
Serial nubmer of the switch. | |
state string |
|
Specifies whether a switchport should be queried or modified. |
stp_guard string |
|
Set state of STP guard. |
tags list / elements=string |
List of tags to assign to a port. | |
timeout integer |
Default: 30 |
Time to timeout for HTTP requests. |
type string |
|
Set port type. |
use_https boolean |
|
If Only useful for internal Meraki developers. |
use_proxy boolean |
|
If |
validate_certs boolean |
|
Whether to validate HTTP certificates. |
vlan integer |
VLAN number assigned to port. If a port is of type trunk, the specified VLAN is the native VLAN. | |
voice_vlan integer |
VLAN number assigned to a port for voice traffic. Only applicable to access port type. |
Notes
Note
- More information about the Meraki API can be found at https://dashboard.meraki.com/api_docs.
- Some of the options are likely only used for developers within Meraki.
- As of Ansible 2.9, Meraki modules output keys as snake case. To use camel case, set the
ANSIBLE_MERAKI_FORMAT
environment variable tocamelcase
. - Ansible’s Meraki modules will stop supporting camel case output in Ansible 2.13. Please update your playbooks.
- Check Mode downloads the current configuration from the dashboard, then compares changes against this download. Check Mode will report changed if there are differences in the configurations, but does not submit changes to the API for validation of change.
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.
| |
access_policy_number integer |
success |
Number of assigned access policy. Only applicable to access ports.
Sample: 1234 | |
enabled boolean |
success |
Enabled state of port.
Sample: True | |
isolation_enabled boolean |
success |
Port isolation status of port.
Sample: True | |
link_negotiation 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 | |
poe_enabled boolean |
success |
Power Over Ethernet enabled state of port.
Sample: True | |
rstp_enabled boolean |
success |
Enabled or disabled state of Rapid Spanning Tree Protocol (RSTP)
Sample: True | |
stp_guard string |
success |
State of STP guard
Sample: Root Guard | |
tags list / elements=string |
success |
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 | |
voice_vlan integer |
success |
VLAN assigned to port with voice VLAN enabled devices.
Sample: 20 |
Authors
- Kevin Breit (@kbreit)
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/cisco/meraki/meraki_ms_switchport_module.html