cisco.ios.ios_lacp_interfaces 模块 – 配置 LACP 接口的资源模块。
注意
此模块是 cisco.ios 集合 (版本 9.0.3) 的一部分。
如果您使用的是 ansible
包,则可能已安装此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install cisco.ios
。
要在 playbook 中使用它,请指定: cisco.ios.ios_lacp_interfaces
。
cisco.ios 1.0.0 新增功能
概要
此模块提供对 Cisco IOS 网络设备 lacp_interfaces 上 LACP 的声明式管理。
参数
参数 |
注释 |
---|---|
LACP lacp_interfaces 选项的字典 |
|
此端口通道上支持的 LACP 快速切换。 选项
|
|
此端口通道中捆绑的最大端口数。 请参考供应商文档以获取有效的端口值。 |
|
配置 LACP 的接口名称。 |
|
此接口上的 LACP 优先级。 请参考供应商文档以获取有效的端口值。 |
|
此选项仅与 state *parsed* 一起使用。 此选项的值应为通过执行命令 **show running-config | section ^interface** 从 IOS 设备接收到的输出。 state *parsed* 从 |
|
配置应保留的状态 状态 *rendered*、*gathered* 和 *parsed* 不会对设备进行任何更改。 状态 *rendered* 将 状态 *gathered* 将从设备获取运行配置,并根据资源模块 argspec 将其转换为结构化数据,并在结果中的 *gathered* 键中返回该值。 状态 *parsed* 从 选项
|
备注
注意
在 CML 上针对 Cisco IOSXE 版本 17.3 进行了测试。
此模块适用于连接
network_cli
。请参阅 https://docs.ansible.org.cn/ansible/latest/network/user_guide/platform_ios.html
示例
# Using merged
#
# Before state:
# -------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
# shutdown
# interface GigabitEthernet0/2
# shutdown
# interface GigabitEthernet0/3
# shutdown
- name: Merge provided configuration with device configuration
cisco.ios.ios_lacp_interfaces:
config:
- name: GigabitEthernet0/1
port_priority: 10
- name: GigabitEthernet0/2
port_priority: 20
- name: GigabitEthernet0/3
port_priority: 30
- name: Port-channel10
fast_switchover: true
max_bundle: 5
state: merged
# After state:
# ------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
# lacp fast-switchover
# lacp max-bundle 5
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
# shutdown
# lacp port-priority 10
# interface GigabitEthernet0/2
# shutdown
# lacp port-priority 20
# interface GigabitEthernet0/3
# shutdown
# lacp port-priority 30
# Using overridden
#
# Before state:
# -------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
# lacp fast-switchover
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
# shutdown
# lacp port-priority 10
# interface GigabitEthernet0/2
# shutdown
# lacp port-priority 20
# interface GigabitEthernet0/3
# shutdown
# lacp port-priority 30
- name: Override device configuration of all lacp_interfaces with provided configuration
cisco.ios.ios_lacp_interfaces:
config:
- name: GigabitEthernet0/1
port_priority: 20
- name: Port-channel10
max_bundle: 2
state: overridden
# After state:
# ------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
# lacp max-bundle 2
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
# shutdown
# lacp port-priority 20
# interface GigabitEthernet0/2
# shutdown
# interface GigabitEthernet0/3
# shutdown
# Using replaced
#
# Before state:
# -------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
# lacp max-bundle 5
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
# shutdown
# lacp port-priority 10
# interface GigabitEthernet0/2
# shutdown
# lacp port-priority 20
# interface GigabitEthernet0/3
# shutdown
# lacp port-priority 30
- name: Replaces device configuration of listed lacp_interfaces with provided configuration
cisco.ios.ios_lacp_interfaces:
config:
- name: GigabitEthernet0/3
port_priority: 40
- name: Port-channel10
fast_switchover: true
max_bundle: 2
state: replaced
# After state:
# ------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
# lacp fast-switchover
# lacp max-bundle 2
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
# shutdown
# lacp port-priority 10
# interface GigabitEthernet0/2
# shutdown
# lacp port-priority 20
# interface GigabitEthernet0/3
# shutdown
# lacp port-priority 40
# Using Deleted
#
# Before state:
# -------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
# flowcontrol receive on
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
# shutdown
# lacp port-priority 10
# interface GigabitEthernet0/2
# shutdown
# lacp port-priority 20
# interface GigabitEthernet0/3
# shutdown
# lacp port-priority 30
- name: "Delete LACP attributes of given interfaces (Note: This won't delete the interface itself)"
cisco.ios.ios_lacp_interfaces:
config:
- name: GigabitEthernet0/1
state: deleted
# After state:
# -------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
# shutdown
# interface GigabitEthernet0/2
# shutdown
# lacp port-priority 20
# interface GigabitEthernet0/3
# shutdown
# lacp port-priority 30
# Using Deleted without any config passed
# "(NOTE: This will delete all of configured LLDP module attributes)"
#
# Before state:
# -------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
# lacp fast-switchover
# interface Port-channel20
# lacp max-bundle 2
# interface Port-channel30
# interface GigabitEthernet0/1
# shutdown
# lacp port-priority 10
# interface GigabitEthernet0/2
# shutdown
# lacp port-priority 20
# interface GigabitEthernet0/3
# shutdown
# lacp port-priority 30
- name: "Delete LACP attributes for all configured interfaces (Note: This won't delete the interface itself)"
cisco.ios.ios_lacp_interfaces:
state: deleted
# After state:
# -------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
# shutdown
# interface GigabitEthernet0/2
# shutdown
# interface GigabitEthernet0/3
# shutdown
# Using Gathered
# Before state:
# -------------
#
# vios#sh running-config | section ^interface
# interface Port-channel10
# lacp fast-switchover
# lacp max-bundle 2
# interface Port-channel40
# lacp max-bundle 5
# interface GigabitEthernet0/0
# interface GigabitEthernet0/1
# lacp port-priority 30
# interface GigabitEthernet0/2
# lacp port-priority 20
- name: Gather listed LACP interfaces with provided configurations
cisco.ios.ios_lacp_interfaces:
config:
state: gathered
# Module Execution Result:
# ------------------------
#
# "gathered": [
# {
# "fast_switchover": true,
# "max_bundle": 2,
# "name": "Port-channel10"
# },
# {
# "max_bundle": 5,
# "name": "Port-channel40"
# },
# {
# "name": "GigabitEthernet0/0"
# },
# {
# "name": "GigabitEthernet0/1",
# "port_priority": 30
# },
# {
# "name": "GigabitEthernet0/2",
# "port_priority": 20
# }
# ]
# After state:
# ------------
#
# vios#sh running-config | section ^interface
# interface Port-channel10
# lacp fast-switchover
# lacp max-bundle 2
# interface Port-channel40
# lacp max-bundle 5
# interface GigabitEthernet0/0
# interface GigabitEthernet0/1
# lacp port-priority 30
# interface GigabitEthernet0/2
# lacp port-priority 20
# Using Rendered
- name: Render the commands for provided configuration
cisco.ios.ios_lacp_interfaces:
config:
- name: GigabitEthernet0/1
port_priority: 10
- name: GigabitEthernet0/2
port_priority: 20
- name: Port-channel10
fast_switchover: true
max_bundle: 2
state: rendered
# Module Execution Result:
# ------------------------
#
# "rendered": [
# "interface GigabitEthernet0/1",
# "lacp port-priority 10",
# "interface GigabitEthernet0/2",
# "lacp port-priority 20",
# "interface Port-channel10",
# "lacp max-bundle 2",
# "lacp fast-switchover"
# ]
# Using Parsed
# File: parsed.cfg
# ----------------
#
# interface GigabitEthernet0/1
# lacp port-priority 10
# interface GigabitEthernet0/2
# lacp port-priority 20
# interface Port-channel10
# lacp max-bundle 2 fast-switchover
- name: Parse the commands for provided configuration
cisco.ios.ios_lacp_interfaces:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Module Execution Result:
# ------------------------
#
# "parsed": [
# {
# "name": "GigabitEthernet0/1",
# "port_priority": 10
# },
# {
# "name": "GigabitEthernet0/2",
# "port_priority": 20
# },
# {
# "fast_switchover": true,
# "max_bundle": 2,
# "name": "Port-channel10"
# }
# ]
返回值
常见的返回值已在此处记录 此处,以下是此模块独有的字段
键 |
描述 |
---|---|
模块完成后的结构化数据配置。 返回:发生更改时 示例: |
|
模块调用之前的结构化数据配置。 返回:始终返回 示例: |
|
推送到远程设备的命令集。 返回:始终返回 示例: |