eos_vlans – Manage VLANs on Arista EOS devices

From Get docs
Ansible/docs/2.9/modules/eos vlans module


eos_vlans – Manage VLANs on Arista EOS devices

New in version 2.9.


Synopsis

  • This module provides declarative management of VLANs on Arista EOS network devices.

Parameters

Parameter Choices/Defaults Comments

config

list / elements=dictionary

A dictionary of VLANs options

name

string

Name of the VLAN.

state

string

  • active
  • suspend

Operational state of the VLAN

vlan_id

integer / required

ID of the VLAN. Range 1-4094

state

string

  • merged

  • replaced
  • overridden
  • deleted

The state of the configuration after module completion



Notes

Note

  • Tested against Arista EOS 4.20.10M
  • This module works with connection network_cli. See the EOS Platform Options.


Examples

# 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.
  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
  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
  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
  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

Return Values

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']




Status

Red Hat Support

More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.

Authors

  • Nathaniel Case (@qalthos)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.


© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.9/modules/eos_vlans_module.html