arista.eos.eos_vlans 模块 – VLAN 资源模块
注意
此模块是 arista.eos 集合 (版本 10.0.1) 的一部分。
如果您使用的是 ansible
软件包,则可能已经安装了此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install arista.eos
。
要在 playbook 中使用它,请指定:arista.eos.eos_vlans
。
arista.eos 1.0.0 中的新增功能
概要
此模块提供对 Arista EOS 网络设备上 VLAN 的声明式管理。
参数
参数 |
注释 |
---|---|
VLAN 选项的字典 |
|
VLAN 的名称。 |
|
VLAN 的运行状态 选项
|
|
VLAN 的 ID。范围 1-4094 |
|
此选项仅与 state 为 parsed 时使用。 此选项的值应为通过执行命令 show running-config | section vlan 从 EOS 设备接收到的输出。 state 为 parsed 时,会从 |
|
模块完成后的配置状态 选项
|
备注
注意
针对 Arista EOS 4.24.6F 进行测试
此模块与连接
network_cli
配合使用。请参见 EOS 平台选项。
示例
# 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
返回值
常见的返回值已在 此处 记录,以下是此模块独有的字段
键 |
描述 |
---|---|
模块完成后的配置作为结构化数据。 返回:发生更改时 示例: |
|
模块调用前的配置作为结构化数据。 返回:始终返回 示例: |
|
推送到远程设备的命令集。 返回:始终返回 示例: |