dellemc.enterprise_sonic.sonic_l2_interfaces module – Configure interface-to-VLAN association that is based on access or trunk mode
Note
This module is part of the dellemc.enterprise_sonic collection (version 1.1.2).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install dellemc.enterprise_sonic
.
To use it in a playbook, specify: dellemc.enterprise_sonic.sonic_l2_interfaces
.
New in dellemc.enterprise_sonic 1.0.0
Synopsis
Manages Layer 2 interface attributes of Enterprise SONiC Distribution by Dell Technologies.
Note
This module has a corresponding action plugin.
Parameters
Parameter |
Comments |
---|---|
A list of Layer 2 interface configurations. |
|
Configures access mode characteristics of the interface. |
|
Configures the specified VLAN in access mode. |
|
Full name of the interface, for example, ‘Eth1/26’. |
|
Configures trunking parameters on an interface. |
|
Specifies list of allowed VLANs of trunk mode on the interface. |
|
Configures the specified VLAN in trunk mode. |
|
The state that the configuration should be left in. Choices:
|
Notes
Note
Tested against Enterprise SONiC Distribution by Dell Technologies.
Supports
check_mode
.
Examples
# Using deleted
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Eth1/3
#11 Inactive T Eth1/3
#12 Inactive A Eth1/4
#13 Inactive T Eth1/4
#14 Inactive A Eth1/5
#15 Inactive T Eth1/5
#
- name: Configures switch port of interfaces
dellemc.enterprise_sonic.sonic_l2_interfaces:
config:
- name: Eth1/3
- name: Eth1/4
state: deleted
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#11 Inactive
#12 Inactive
#13 Inactive
#14 Inactive A Eth1/5
#15 Inactive T Eth1/5
#
#
# Using deleted
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Eth1/3
#11 Inactive T Eth1/3
#12 Inactive A Eth1/4
#13 Inactive T Eth1/4
#14 Inactive A Eth1/5
#15 Inactive T Eth1/5
#
- name: Configures switch port of interfaces
dellemc.enterprise_sonic.sonic_l2_interfaces:
config:
state: deleted
#
# After state:
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#11 Inactive
#12 Inactive
#13 Inactive
#14 Inactive
#15 Inactive
#
#
# Using merged
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#11 Inactive T Eth1/7
#12 Inactive T Eth1/7
#
- name: Configures switch port of interfaces
dellemc.enterprise_sonic.sonic_l2_interfaces:
config:
- name: Eth1/3
access:
vlan: 10
state: merged
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Eth1/3
#11 Inactive T Eth1/7
#12 Inactive T Eth1/7
#
#
# Using merged
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Eth1/3
#
- name: Configures switch port of interfaces
dellemc.enterprise_sonic.sonic_l2_interfaces:
config:
- name: Eth1/3
trunk:
allowed_vlans:
- vlan: 11
- vlan: 12
state: merged
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive A Eth1/3
#11 Inactive T Eth1/7
#12 Inactive T Eth1/7
#
#
# Using merged
#
# Before state:
# -------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#11 Inactive
#12 Inactive A Eth1/4
#13 Inactive T Eth1/4
#14 Inactive A Eth1/5
#15 Inactive T Eth1/5
#
- name: Configures switch port of interfaces
dellemc.enterprise_sonic.sonic_l2_interfaces:
config:
- name: Eth1/3
access:
vlan: 12
trunk:
allowed_vlans:
- vlan: 13
- vlan: 14
state: merged
#
# After state:
# ------------
#
#do show Vlan
#Q: A - Access (Untagged), T - Tagged
#NUM Status Q Ports
#10 Inactive
#11 Inactive
#12 Inactive A Eth1/3
# A Eth1/4
#13 Inactive T Eth1/3
# T Eth1/4
#14 Inactive A Eth1/3
# A Eth1/5
#15 Inactive T Eth1/5
#
#
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
The resulting configuration model invocation. Returned: when changed Sample: |
|
The configuration prior to the model invocation. Returned: always Sample: |
|
The set of commands pushed to the remote device. Returned: always Sample: |