W3cubDocs

/Ansible

net_l2_interface - Manage Layer-2 interface on network devices

New in version 2.4.

Synopsis

  • This module provides declarative management of Layer-2 interface on network devices.

Options

parameter required default choices comments
access_vlan
no
Configure given VLAN in access port.
aggregate
no
List of Layer-2 interface definitions.
mode
no access
  • access
  • trunk
Mode in which interface needs to be configured.
name
no
Name of the interface excluding any logical unit number.
native_vlan
no
Native VLAN to be configured in trunk port.
state
no present
  • present
  • absent
State of the Layer-2 Interface configuration.
trunk_allowed_vlans
no
List of allowed VLAN's in a given trunk port.
trunk_vlans
no
List of VLANs to be configured in trunk port.

Examples

- name: configure Layer-2 interface
  net_l2_interface:
    name: gigabitethernet0/0/1
    mode: access
    access_vlan: 30

- name: remove Layer-2 interface configuration
  net_l2_interface:
    name: gigabitethernet0/0/1
    state: absent

Return Values

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

name description returned type sample
commands
The list of configuration mode commands to send to the device
always, except for the platforms that use Netconf transport to manage the device. list ['interface gigabitethernet0/0/1', 'switchport mode access', 'switchport access vlan 30']

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance Info

For more information about Red Hat’s this support of this module, please refer to this knowledge base article<https://access.redhat.com/articles/rhel-top-support-policies>

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/net_l2_interface_module.html