Skip to content

Latest commit

 

History

History
420 lines (358 loc) · 12.5 KB

arista.eos.eos_vlans_module.rst

File metadata and controls

420 lines (358 loc) · 12.5 KB

arista.eos.eos_vlans

VLANs resource module

Version added: 1.0.0

  • This module provides declarative management of VLANs on Arista EOS network devices.
Parameter Choices/Defaults Comments
config
list / elements=dictionary
A dictionary of VLANs options
name
string
Name of the VLAN.
state
string
    Choices:
  • active
  • suspend
Operational state of the VLAN
vlan_id
integer / required
ID of the VLAN. Range 1-4094
running_config
string
This option is used only with state parsed.
The value of this option should be the output received from the EOS device by executing the command show running-config | section vlan.
The state parsed reads the configuration from running_config option and transforms it into Ansible structured data as per the resource module's argspec and the value
state
string
    Choices:
  • merged ←
  • replaced
  • overridden
  • deleted
  • rendered
  • gathered
  • parsed
The state of the configuration after module completion

Note

  • Tested against Arista EOS 4.24.6F
  • This module works with connection network_cli. See the EOS Platform Options.
# Using deleted

# Before state:
# -------------
#
# veos(config-vlan-20)#show running-config | section vlan
# vlan 10
#    name ten
# !
# vlan 20
#    name twenty

- name: Delete attributes of the given VLANs.
  arista.eos.eos_vlans:
    config:
      - vlan_id: 20
    state: deleted

# After state:
# ------------
#
# veos(config-vlan-20)#show running-config | section vlan
# vlan 10
#    name ten


# Using merged

# Before state:
# -------------
#
# veos(config-vlan-20)#show running-config | section vlan
# vlan 10
#    name ten
# !
# vlan 20
#    name twenty

- name: Merge given VLAN attributes with device configuration
  arista.eos.eos_vlans:
    config:
      - vlan_id: 20
        state: suspend
    state: merged

# After state:
# ------------
#
# veos(config-vlan-20)#show running-config | section vlan
# vlan 10
#    name ten
# !
# vlan 20
#    name twenty
#    state suspend


# Using overridden

# Before state:
# -------------
#
# veos(config-vlan-20)#show running-config | section vlan
# vlan 10
#    name ten
# !
# vlan 20
#    name twenty

- name: Override device configuration of all VLANs with provided configuration
  arista.eos.eos_vlans:
    config:
      - vlan_id: 20
        state: suspend
    state: overridden

# After state:
# ------------
#
# veos(config-vlan-20)#show running-config | section vlan
# vlan 20
#    state suspend


# Using replaced

# Before state:
# -------------
#
# veos(config-vlan-20)#show running-config | section vlan
# vlan 10
#    name ten
# !
# vlan 20
#    name twenty

- name: Replace all attributes of specified VLANs with provided configuration
  arista.eos.eos_vlans:
    config:
      - vlan_id: 20
        state: suspend
    state: replaced

# After state:
# ------------
#
# veos(config-vlan-20)#show running-config | section vlan
# vlan 10
#    name ten
# !
# vlan 20
#    state suspend

# using parsed

# parsed.cfg
# vlan 10
#    name ten
# !
# vlan 20
#    name twenty
#    state suspend

- name: Use parsed to convert native configs to structured data
  arista.eos.eos_vlans:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed

# Output:
# -------
#   parsed:
#     - vlan_id: 10
#       name: ten
#     - vlan_id: 20
#       state: suspend

# Using rendered:

- name: Use Rendered to convert the structured data to native config
  arista.eos.eos_vlans:
    config:
      - vlan_id: 10
        name: ten
      - vlan_id: 20
        state: suspend
    state: rendered

# Output:
# ------
# rendered:
#   - "vlan 10"
#   - "name ten"
#   - "vlan 20"
#   - "state suspend"

# Using gathered:
# native_config:
# vlan 10
#    name ten
# !
# vlan 20
#    name twenty
#    state suspend

- name: Gather vlans facts from the device
  arista.eos.eos_vlans:
    state: gathered

# Output:
# ------

# gathered:
#   - vlan_id: 10
#     name: ten
#   - vlan_id: 20
#     state: suspend

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

Key Returned Description
after
list
when changed
The configuration as structured data after module completion.

Sample:
The configuration returned will always be in the same format of the parameters above.
before
list
always
The configuration as structured data prior to module invocation.

Sample:
The configuration returned will always be in the same format of the parameters above.
commands
list
always
The set of commands pushed to the remote device.

Sample:
['vlan 10', 'no name', 'vlan 11', 'name Eleven']


Authors

  • Nathaniel Case (@qalthos)