cisco / cisco.meraki / 2.9.0 / module / meraki_ms_switchport Manage switchports on a switch in the Meraki cloud Authors: Kevin Breit (@kbreit) preview | supported by communitycisco.meraki.meraki_ms_switchport (2.9.0) — module
Install with ansible-galaxy collection install cisco.meraki:==2.9.0
collections: - name: cisco.meraki version: 2.9.0
Allows for management of switchports settings for Meraki MS switches.
- 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
- name: Configure access port with sticky MAC allow list and limit. meraki_switchport: auth_key: abc12345 state: present serial: ABC-123 number: 5 sticky_mac_allow_limit: 3 sticky_mac_allow_list: macs: - aa:aa:bb:bb:cc:cc - bb:bb:aa:aa:cc:cc - 11:aa:bb:bb:cc:cc state: replaced delegate_to: localhost
- name: Delete an existing MAC address from the sticky MAC allow list. meraki_switchport: auth_key: abc12345 state: present serial: ABC-123 number: 5 sticky_mac_allow_list: macs: - aa:aa:bb:bb:cc:cc state: deleted delegate_to: localhost
- name: Add a MAC address to sticky MAC allow list. meraki_switchport: auth_key: abc12345 state: present serial: ABC-123 number: 5 sticky_mac_allow_list: macs: - 22:22:bb:bb:cc:cc state: merged delegate_to: localhost
host: default: api.meraki.com description: - Hostname for Meraki dashboard. - Can be used to access regional Meraki environments, such as China. type: str name: aliases: - description description: - Switchport description. type: str tags: description: - List of tags to assign to a port. elements: str type: list type: choices: - access - trunk default: access description: - Set port type. type: str vlan: description: - VLAN number assigned to port. - If a port is of type trunk, the specified VLAN is the native VLAN. - Setting value to 0 on a trunk will clear the VLAN. type: int state: choices: - query - present default: query description: - Specifies whether a switchport should be queried or modified. type: str number: description: - Port number. type: str org_id: description: - ID of organization. type: str serial: description: - Serial nubmer of the switch. required: true type: str enabled: default: true description: - Whether a switchport should be enabled or disabled. type: bool timeout: default: 30 description: - Time to timeout for HTTP requests. type: int auth_key: description: - Authentication key provided by the dashboard. Required if environmental variable C(MERAKI_KEY) is not set. required: true type: str org_name: aliases: - organization description: - Name of organization. type: str stp_guard: choices: - disabled - root guard - bpdu guard - loop guard default: disabled description: - Set state of STP guard. type: str use_https: default: true description: - If C(no), it will use HTTP. Otherwise it will use HTTPS. - Only useful for internal Meraki developers. type: bool use_proxy: default: false description: - If C(no), it will not use a proxy, even if one is defined in an environment variable on the target hosts. type: bool voice_vlan: description: - VLAN number assigned to a port for voice traffic. - Only applicable to access port type. - Only applicable if voice_vlan_state is set to present. type: int poe_enabled: default: true description: - Enable or disable Power Over Ethernet on a port. type: bool output_level: choices: - debug - normal default: normal description: - Set amount of debug output during module execution. type: str rstp_enabled: default: true description: - Enable or disable Rapid Spanning Tree Protocol on a port. type: bool allowed_vlans: default: all description: - List of VLAN numbers to be allowed on switchport. elements: str type: list output_format: choices: - snakecase - camelcase default: snakecase description: - Instructs module whether response keys should be snake case (ex. C(net_id)) or camel case (ex. C(netId)). type: str mac_allow_list: description: - MAC addresses list that are allowed on a port. - Only applicable to access port type. - Only applicable to access_policy_type "MAC allow list". suboptions: macs: description: - List of MAC addresses to update with based on state option. elements: str type: list state: choices: - merged - replaced - deleted default: replaced description: - The state the configuration should be left in. - Merged, MAC addresses provided will be added to the current allow list. - Replaced, All MAC addresses are overwritten, only the MAC addresses provided with exist in the allow list. - Deleted, Remove the MAC addresses provided from the current allow list. type: str type: dict validate_certs: default: true description: - Whether to validate HTTP certificates. type: bool link_negotiation: choices: - Auto negotiate - 100 Megabit (auto) - 100 Megabit full duplex (forced) default: Auto negotiate description: - Link speed for the switchport. type: str voice_vlan_state: choices: - absent - present default: present description: - Specifies whether voice vlan configuration should be present or absent. type: str isolation_enabled: default: false description: - Isolation status of switchport. type: bool access_policy_type: choices: - Open - Custom access policy - MAC allow list - Sticky MAC allow list description: - Type of access policy to apply to port. type: str access_policy_number: description: - Number of the access policy to apply. - Only applicable to access port types. type: int rate_limit_retry_time: default: 165 description: - Number of seconds to retry if rate limiter is triggered. type: int sticky_mac_allow_list: description: - MAC addresses list that are allowed on a port. - Only applicable to access port type. - Only applicable to access_policy_type "Sticky MAC allow list". suboptions: macs: description: - List of MAC addresses to update with based on state option. elements: str type: list state: choices: - merged - replaced - deleted default: replaced description: - The state the configuration should be left in. - Merged, MAC addresses provided will be added to the current allow list. - Replaced, All MAC addresses are overwritten, only the MAC addresses provided with exist in the allow list. - Deleted, Remove the MAC addresses provided from the current allow list. type: str type: dict flexible_stacking_enabled: description: - Whether flexible stacking capabilities are supported on the port. type: bool internal_error_retry_time: default: 60 description: - Number of seconds to retry if server returns an internal server error. type: int sticky_mac_allow_list_limit: description: - The number of MAC addresses allowed in the sticky port allow list. - Only applicable to access port type. - Only applicable to access_policy_type "Sticky MAC allow list". - The value must be equal to or greater then the list size of sticky_mac_allow_list. Value will be checked for validity, during processing. type: int
data: contains: access_policy_number: description: Number of assigned access policy. Only applicable to access ports. returned: success sample: 1234 type: int access_policy_type: description: Type of access policy assigned to port returned: success, when assigned sample: MAC allow list type: str allowed_vlans: description: List of VLANs allowed on an access port returned: success, when port is set as access sample: all type: str enabled: description: Enabled state of port. returned: success sample: true type: bool flexible_stacking_enabled: description: Whether flexible stacking capabilities are enabled on the port. returned: success type: bool isolation_enabled: description: Port isolation status of port. returned: success sample: true type: bool link_negotiation: description: Link speed for the port. returned: success sample: Auto negotiate type: str mac_allow_list: description: List of MAC addresses currently allowed on a non-sticky port. Used with access_policy_type of MAC allow list. returned: success sample: - 11:aa:bb:bb:cc:cc - 22:aa:bb:bb:cc:cc - 33:aa:bb:bb:cc:cc type: list name: description: Human friendly description of port. returned: success sample: Jim Phone Port type: str number: description: Number of port. returned: success sample: 1 type: int poe_enabled: description: Power Over Ethernet enabled state of port. returned: success sample: true type: bool port_schedule_id: description: Unique ID of assigned port schedule returned: success sample: null type: str rstp_enabled: description: Enabled or disabled state of Rapid Spanning Tree Protocol (RSTP) returned: success sample: true type: bool sticky_mac_allow_list: description: List of MAC addresses currently allowed on a sticky port. Used with access_policy_type of Sticky MAC allow list. returned: success sample: - 11:aa:bb:bb:cc:cc - 22:aa:bb:bb:cc:cc - 33:aa:bb:bb:cc:cc type: list sticky_mac_allow_list_limit: description: Number of MAC addresses allowed on a sticky port. returned: success sample: 6 type: int stp_guard: description: State of STP guard returned: success sample: Root Guard type: str tags: description: List of tags assigned to port. returned: success sample: - phone - marketing type: list type: description: Type of switchport. returned: success sample: trunk type: str udld: description: Alert state of UDLD returned: success sample: Alert only type: str vlan: description: VLAN assigned to port. returned: success sample: 10 type: int voice_vlan: description: VLAN assigned to port with voice VLAN enabled devices. returned: success sample: 20 type: int description: Information queried or updated switchports. returned: success type: complex