.. _vyos.rest.vyos_vlan_module: ******************* vyos.rest.vyos_vlan ******************* **Manage VLAN (vif) configuration on VyOS devices using REST API** Version added: 1.0.0 .. contents:: :local: :depth: 1 Synopsis -------- - Manages VLAN sub-interface configuration on VyOS Ethernet interfaces via the REST API. - Uses REST API (``connection=httpapi``) instead of CLI. Parameters ---------- .. raw:: html
Parameter Choices/Defaults Comments
config
list / elements=dictionary
List of VLAN configurations.
address
string
IP address for the VLAN interface.
description
string
VLAN description.
interfaces
list / elements=string / required
List of Ethernet interfaces to configure this VLAN on.
vlan_id
integer / required
VLAN ID (0-4094).
state
string
    Choices:
  • present ←
  • absent
  • gathered
present creates or updates VLANs.
absent removes VLANs.
gathered returns current VLAN configuration.

Notes ----- .. note:: - Requires ``ansible_connection=httpapi`` with the VyOS httpapi plugin. - ``ansible_network_os`` must be set to ``vyos.rest.vyos``. Examples -------- .. code-block:: yaml - name: Configure VLANs vyos.rest.vyos_vlan: config: - vlan_id: 10 description: VLAN10 address: 192.168.10.1/24 interfaces: - eth1 - vlan_id: 20 description: VLAN20 interfaces: - eth1 - eth2 state: present - name: Remove a VLAN vyos.rest.vyos_vlan: config: - vlan_id: 10 interfaces: - eth1 state: absent - name: Gather VLAN configuration vyos.rest.vyos_vlan: state: gathered Return Values ------------- Common return values are documented `here `_, the following are the fields unique to this module: .. raw:: html
Key Returned Description
after
list
when changed
VLAN configuration after this module ran.

before
list
always
VLAN configuration before this module ran.

commands
list
always
List of API command tuples sent to the device.

gathered
list
when state is gathered
Current VLAN configuration as structured data.

response
dictionary
always
Raw API response.

saved
boolean
when changed
Whether the config was saved after changes.



Status ------ Authors ~~~~~~~ - VyOS Community (@vyos)