ansible.builtin.net_vlan (v2.8.19) — module

Manage VLANs on network devices

| "added in version" 2.4 of ansible.builtin"

Authors: Ricardo Carrillo Cruz (@rcarrillocruz)

preview | supported by network

Install Ansible via pip

Install with pip install ansible==2.8.19

Description

This module provides declarative management of VLANs on network devices.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configure VLAN ID and name
  net_vlan:
    vlan_id: 20
    name: test-vlan
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: remove configuration
  net_vlan:
    state: absent
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configure VLAN state
  net_vlan:
    vlan_id:
    state: suspend

Inputs

    
name:
    description:
    - Name of the VLAN.

purge:
    default: false
    description:
    - Purge VLANs not defined in the I(aggregate) parameter.

state:
    choices:
    - present
    - absent
    - active
    - suspend
    default: present
    description:
    - State of the VLAN configuration.

vlan_id:
    description:
    - ID of the VLAN.

aggregate:
    description: List of VLANs definitions.

interfaces:
    description:
    - List of interfaces the VLAN should be configured on.

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:
  - vlan 20
  - name test-vlan
  type: list