Deprecated

Removed in None

i

Reason:Updated modules released with more functionality | Alternative:Use platform-specific "[netos]_l2_interfaces" module

ansible.netcommon.net_l2_interface (3.1.3) — module

(deprecated, removed after 2022-06-01) Manage Layer-2 interface on network devices

| "added in version" 1.0.0 of ansible.netcommon"

Authors: Ganesh Nalawade (@ganeshrn)

This plugin has a corresponding action plugin.

Install collection

Install with ansible-galaxy collection install ansible.netcommon:==3.1.3


Add to requirements.yml

  collections:
    - name: ansible.netcommon
      version: 3.1.3

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configure Layer-2 interface
  ansible.netcommon.net_l2_interface:
    name: gigabitethernet0/0/1
    mode: access
    access_vlan: 30
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: remove Layer-2 interface configuration
  ansible.netcommon.net_l2_interface:
    name: gigabitethernet0/0/1
    state: absent

Inputs

    
mode:
    choices:
    - access
    - trunk
    default: access
    description:
    - Mode in which interface needs to be configured.

name:
    description:
    - Name of the interface excluding any logical unit number.

state:
    choices:
    - present
    - absent
    default: present
    description:
    - State of the Layer-2 Interface configuration.

aggregate:
    description:
    - List of Layer-2 interface definitions.

access_vlan:
    description:
    - Configure given VLAN in access port.

native_vlan:
    description:
    - Native VLAN to be configured in trunk port.

trunk_vlans:
    description:
    - List of VLANs to be configured in trunk port.

trunk_allowed_vlans:
    description:
    - List of allowed VLAN's in a given trunk port.

Outputs

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