community.general.edgeswitch_vlan (0.1.1) — module

Manage VLANs on Ubiquiti Edgeswitch network devices

Authors: Frederic Bor (@f-bor)

preview | supported by community

Install collection

Install with ansible-galaxy collection install community.general:==0.1.1


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.1

Description

This module provides declarative management of VLANs on Ubiquiti Edgeswitch network devices.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create vlan
  edgeswitch_vlan:
    vlan_id: 100
    name: voice
    action: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add interfaces to VLAN
  edgeswitch_vlan:
    vlan_id: 100
    tagged_interfaces:
      - 0/1
      - 0/4-0/6
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: setup three vlans and delete the rest
  edgeswitch_vlan:
    purge: true
    aggregate:
      - { vlan_id: 1, name: default, auto_untag: true, excluded_interfaces: 0/45-0/48 }
      - { vlan_id: 100, name: voice, auto_tag: true }
      - { vlan_id: 200, name: video, auto_exclude: true, untagged_interfaces: 0/45-0/48, tagged_interfaces: 0/49 }
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete vlan
  edgeswitch_vlan:
    vlan_id: 100
    state: absent

Inputs

    
name:
    description:
    - Name of the VLAN.

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

state:
    choices:
    - present
    - absent
    default: present
    description:
    - action on the VLAN configuration.

vlan_id:
    description:
    - ID of the VLAN. Range 1-4093.

auto_tag:
    description:
    - Each of the switch interfaces will be set to accept and transmit untagged frames
      for I(vlan_id) unless defined in I(*_interfaces). This is a default setting for
      all switch interfaces.
    type: bool

aggregate:
    description: List of VLANs definitions.

auto_untag:
    description:
    - Each of the switch interfaces will be set to accept untagged frames and transmit
      them tagged for I(vlan_id) unless defined in I(*_interfaces). This is a default
      setting for all switch interfaces.
    type: bool

auto_exclude:
    description:
    - Each of the switch interfaces will be excluded from I(vlan_id) unless defined in
      I(*_interfaces). This is a default setting for all switch interfaces.
    type: bool

tagged_interfaces:
    description:
    - List of interfaces that should accept and transmit tagged frames for the VLAN. Accept
      range of interfaces.

excluded_interfaces:
    description:
    - List of interfaces that should be excluded of the VLAN. Accept range of interfaces.

untagged_interfaces:
    description:
    - List of interfaces that should accept untagged frames and transmit them tagged for
      the VLAN. Accept range of interfaces.

Outputs

commands:
  description: The list of configuration mode commands to send to the device
  returned: always
  sample:
  - vlan database
  - vlan 100
  - vlan name 100 "test vlan"
  - exit
  - interface 0/1
  - vlan pvid 50
  - vlan participation include 50,100
  - vlan tagging 100
  - vlan participation exclude 200
  - no vlan tagging 200
  type: list