cisco.iosxr.iosxr_lag_interfaces 模块 – 配置 LAG 接口的资源模块。
注意
此模块是 cisco.iosxr 集合 (版本 10.2.2) 的一部分。
如果您使用的是 ansible
包,则可能已安装此集合。它不包含在 ansible-core
中。要检查是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install cisco.iosxr
。
要在 playbook 中使用它,请指定: cisco.iosxr.iosxr_lag_interfaces
。
cisco.iosxr 1.0.0 中的新增功能
概要
此模块管理 IOS-XR 设备上 LAG/以太网捆绑接口的属性。
参数
参数 |
注释 |
---|---|
提供的链路聚合组 (LAG) 配置。 |
|
此字典包含与 LAG/以太网捆绑链路相关的可配置选项。 |
|
指定 LAG/以太网捆绑中可以处于活动状态的链路数量限制。 请参阅供应商文档以了解有效值。 |
|
指定启动 LAG/以太网捆绑所需的最小活动链路数。 请参阅供应商文档以了解有效值。 |
|
指定用于转发通过 LAG/以太网捆绑的流量的哈希函数。 选项“dst-ip”使用目标 IP 作为哈希函数。 选项“src-ip”使用源 IP 作为哈希函数。 选项
|
|
LAG/以太网捆绑的成员接口列表。 |
|
成员接口的名称。 |
|
指定成员接口操作模式。 模式“active”以主动模式运行 LACP。 模式“on”不在端口上运行 LACP。 模式“passive”以被动模式在端口上运行 LACP。 模式“inherit”按照捆绑中的配置运行 LACP。 选项
|
|
LAG 模式。 模式“active”以主动模式在端口上运行 LACP。 模式“on”不在端口上运行 LACP。 模式“passive”以被动模式在端口上运行 LACP。 选项
|
|
要配置的 LAG/以太网捆绑的名称/标识符。 |
|
此选项仅与状态 *parsed* 一起使用。 此选项的值应是从 IOS-XR 设备通过执行命令 **show running-config int** 收到的输出。 状态 *parsed* 从 |
|
模块完成后配置的状态。 选项
|
备注
注意
此模块与连接
network_cli
一起使用。请参见 IOS-XR 平台选项。
示例
# Using merged
#
#
# ------------
# Before state
# ------------
#
# RP/0/0/CPU0:iosxr01#show run int
# Sun Jul 7 19:42:59.416 UTC
# interface Loopback888
# description test for ansible
# shutdown
# !
# interface MgmtEth0/0/CPU0/0
# ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
# description "GigabitEthernet - 1"
# !
# interface GigabitEthernet0/0/0/2
# description "GigabitEthernet - 2"
# !
# interface GigabitEthernet0/0/0/3
# description "GigabitEthernet - 3"
# !
# interface GigabitEthernet0/0/0/4
# description "GigabitEthernet - 4"
# !
#
#
- name: Merge provided configuration with device configuration
cisco.iosxr.iosxr_lag_interfaces:
config:
- name: Bundle-Ether10
members:
- member: GigabitEthernet0/0/0/1
mode: inherit
- member: GigabitEthernet0/0/0/3
mode: inherit
mode: active
links:
max_active: 5
min_active: 2
load_balancing_hash: src-ip
- name: Bundle-Ether12
members:
- member: GigabitEthernet0/0/0/2
mode: passive
- member: GigabitEthernet0/0/0/4
mode: passive
load_balancing_hash: dst-ip
state: merged
#
#
# -----------
# After state
# -----------
#
# RP/0/0/CPU0:iosxr01#show run int
# Sun Jul 7 20:51:17.685 UTC
# interface Bundle-Ether10
# lacp mode active
# bundle load-balancing hash src-ip
# bundle maximum-active links 5
# bundle minimum-active links 2
# !
# interface Bundle-Ether12
# bundle load-balancing hash dst-ip
# !
# interface Loopback888
# description test for ansible
# shutdown
# !
# interface MgmtEth0/0/CPU0/0
# ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
# description 'GigabitEthernet - 1"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
# description "GigabitEthernet - 2"
# bundle id 12 mode passive
# !
# interface GigabitEthernet0/0/0/3
# description "GigabitEthernet - 3"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/4
# description "GigabitEthernet - 4"
# bundle id 12 mode passive
# !
#
# Using replaced
#
#
# -------------
# Before state
# -------------
#
#
# RP/0/0/CPU0:iosxr01#sho run int
# Sun Jul 7 20:58:06.527 UTC
# interface Bundle-Ether10
# lacp mode active
# bundle load-balancing hash src-ip
# bundle maximum-active links 5
# bundle minimum-active links 2
# !
# interface Bundle-Ether12
# bundle load-balancing hash dst-ip
# !
# interface Loopback888
# description test for ansible
# shutdown
# !
# interface MgmtEth0/0/CPU0/0
# ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
# description 'GigabitEthernet - 1"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
# description "GigabitEthernet - 2"
# bundle id 12 mode passive
# !
# interface GigabitEthernet0/0/0/3
# description "GigabitEthernet - 3"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/4
# description "GigabitEthernet - 4"
# bundle id 12 mode passive
# !
#
#
- name: Replace device configuration of listed Bundles with provided configurations
cisco.iosxr.iosxr_lag_interfaces:
config:
- name: Bundle-Ether12
members:
- name: GigabitEthernet0/0/0/2
mode: passive
- name: Bundle-Ether11
members:
- name: GigabitEthernet0/0/0/4
load_balancing_hash: src-ip
state: replaced
#
#
# -----------
# After state
# -----------
#
#
# RP/0/0/CPU0:iosxr01#sh run int
# Sun Jul 7 21:22:27.397 UTC
# interface Bundle-Ether10
# lacp mode active
# bundle load-balancing hash src-ip
# bundle maximum-active links 5
# bundle minimum-active links 2
# !
# interface Bundle-Ether11
# bundle load-balancing hash src-ip
# !
# interface Bundle-Ether12
# lacp mode passive
# !
# interface Loopback888
# description test for ansible
# shutdown
# !
# interface MgmtEth0/0/CPU0/0
# ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
# description 'GigabitEthernet - 1"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
# description "GigabitEthernet - 2"
# bundle id 12 mode on
# !
# interface GigabitEthernet0/0/0/3
# description "GigabitEthernet - 3"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/4
# description "GigabitEthernet - 4"
# bundle id 11 mode on
# !
#
#
# Using overridden
#
#
# ------------
# Before state
# ------------
#
#
# RP/0/0/CPU0:iosxr01#sh run int
# Sun Jul 7 21:22:27.397 UTC
# interface Bundle-Ether10
# lacp mode active
# bundle load-balancing hash src-ip
# bundle maximum-active links 5
# bundle minimum-active links 2
# !
# interface Bundle-Ether11
# bundle load-balancing hash src-ip
# !
# interface Bundle-Ether12
# lacp mode passive
# !
# interface Loopback888
# description test for ansible
# shutdown
# !
# interface MgmtEth0/0/CPU0/0
# ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
# description 'GigabitEthernet - 1"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
# description "GigabitEthernet - 2"
# bundle id 12 mode on
# !
# interface GigabitEthernet0/0/0/3
# description "GigabitEthernet - 3"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/4
# description "GigabitEthernet - 4"
# bundle id 11 mode on
# !
#
#
- name: Overrides all device configuration with provided configuration
cisco.iosxr.iosxr_lag_interfaces:
config:
- name: Bundle-Ether10
members:
- member: GigabitEthernet0/0/0/1
mode: inherit
- member: GigabitEthernet0/0/0/2
mode: inherit
mode: active
load_balancing_hash: dst-ip
state: overridden
#
#
# ------------
# After state
# ------------
#
#
# RP/0/0/CPU0:iosxr01#sh run int
# Sun Jul 7 21:43:04.802 UTC
# interface Bundle-Ether10
# lacp mode active
# bundle load-balancing hash dst-ip
# !
# interface Bundle-Ether11
# !
# interface Bundle-Ether12
# !
# interface Loopback888
# description test for ansible
# shutdown
# !
# interface MgmtEth0/0/CPU0/0
# ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
# description 'GigabitEthernet - 1"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
# description "GigabitEthernet - 2"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/3
# description "GigabitEthernet - 3"
# !
# interface GigabitEthernet0/0/0/4
# description "GigabitEthernet - 4"
# !
#
#
# Using deleted
#
#
# ------------
# Before state
# ------------
#
# RP/0/0/CPU0:iosxr01#sh run int
# Sun Jul 7 21:22:27.397 UTC
# interface Bundle-Ether10
# lacp mode active
# bundle load-balancing hash src-ip
# bundle maximum-active links 5
# bundle minimum-active links 2
# !
# interface Bundle-Ether11
# bundle load-balancing hash src-ip
# !
# interface Bundle-Ether12
# lacp mode passive
# !
# interface Loopback888
# description test for ansible
# shutdown
# !
# interface MgmtEth0/0/CPU0/0
# ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
# description 'GigabitEthernet - 1"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
# description "GigabitEthernet - 2"
# bundle id 12 mode on
# !n
# interface GigabitEthernet0/0/0/3
# description "GigabitEthernet - 3"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/4
# description "GigabitEthernet - 4"
# bundle id 11 mode on
# !
#
#
- name: >-
Delete attributes of given bundles and removes member interfaces from them
(Note - This won't delete the bundles themselves)
cisco.iosxr.iosxr_lag_interfaces:
config:
- name: Bundle-Ether10
- name: Bundle-Ether11
- name: Bundle-Ether12
state: deleted
#
#
# ------------
# After state
# ------------
#
# RP/0/0/CPU0:iosxr01#sh run int
# Sun Jul 7 21:49:50.004 UTC
# interface Bundle-Ether10
# !
# interface Bundle-Ether11
# !
# interface Bundle-Ether12
# !
# interface Loopback888
# description test for ansible
# shutdown
# !
# interface MgmtEth0/0/CPU0/0
# ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
# description 'GigabitEthernet - 1"
# !
# interface GigabitEthernet0/0/0/2
# description "GigabitEthernet - 2"
# !
# interface GigabitEthernet0/0/0/3
# description "GigabitEthernet - 3"
# !
# interface GigabitEthernet0/0/0/4
# description "GigabitEthernet - 4"
# !
#
#
# Using deleted (without config)
#
#
# ------------
# Before state
# ------------
#
# RP/0/0/CPU0:an-iosxr#sh run int
# Sun Aug 18 19:49:51.908 UTC
# interface Bundle-Ether10
# lacp mode active
# bundle load-balancing hash src-ip
# bundle maximum-active links 10
# bundle minimum-active links 2
# !
# interface Bundle-Ether11
# bundle load-balancing hash dst-ip
# !
# interface MgmtEth0/0/CPU0/0
# ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/0
# shutdown
# !
# interface GigabitEthernet0/0/0/1
# bundle id 10 mode inherit
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# bundle id 10 mode passive
# shutdown
# !
# interface GigabitEthernet0/0/0/3
# bundle id 11 mode passive
# shutdown
# !
# interface GigabitEthernet0/0/0/4
# bundle id 11 mode passive
# shutdown
# !
#
- name: Delete attributes of all bundles and removes member interfaces from them (Note
- This won't delete the bundles themselves)
cisco.iosxr.iosxr_lag_interfaces:
state: deleted
#
#
# ------------
# After state
# ------------
#
#
# RP/0/0/CPU0:an-iosxr#sh run int
# Sun Aug 18 19:54:22.389 UTC
# interface Bundle-Ether10
# !
# interface Bundle-Ether11
# !
# interface MgmtEth0/0/CPU0/0
# ipv4 address 10.8.38.69 255.255.255.0
# !
# interface GigabitEthernet0/0/0/0
# shutdown
# !
# interface GigabitEthernet0/0/0/1
# shutdown
# !
# interface GigabitEthernet0/0/0/2
# shutdown
# !
# interface GigabitEthernet0/0/0/3
# shutdown
# !
# interface GigabitEthernet0/0/0/4
# shutdown
# !
# Using parsed:
# parsed.cfg
# interface Bundle-Ether10
# lacp mode active
# bundle load-balancing hash src-ip
# bundle maximum-active links 5
# bundle minimum-active links 2
# !
# interface Bundle-Ether12
# bundle load-balancing hash dst-ip
# !
# interface Loopback888
# description test for ansible
# shutdown
# !
# interface MgmtEth0/0/CPU0/0
# ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
# description 'GigabitEthernet - 1"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
# description "GigabitEthernet - 2"
# bundle id 12 mode passive
# !
# interface GigabitEthernet0/0/0/3
# description "GigabitEthernet - 3"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/4
# description "GigabitEthernet - 4"
# bundle id 12 mode passive
# !
#
- name: Convert lag interfaces config to argspec without connecting to the appliance
cisco.iosxr.iosxr_lag_interfaces:
running_config: "{{ lookup('file', './parsed.cfg') }}"
state: parsed
# --------------
# Output
# --------------
# parsed:
# - name: Bundle-Ether10
# members:
# - member: GigabitEthernet0/0/0/1
# mode: inherit
# - member: GigabitEthernet0/0/0/3
# mode: inherit
# mode: active
# links:
# max_active: 5
# min_active: 2
# load_balancing_hash: src-ip
# - name: Bundle-Ether12
# members:
# - member: GigabitEthernet0/0/0/2
# mode: passive
# - member: GigabitEthernet0/0/0/4
# mode: passive
# load_balancing_hash: dst-ip
# using gathered
# Device Config:
# -------------
# interface Bundle-Ether10
# lacp mode active
# bundle load-balancing hash src-ip
# bundle maximum-active links 5
# bundle minimum-active links 2
# !
# interface Bundle-Ether12
# bundle load-balancing hash dst-ip
# !
# interface Loopback888
# description test for ansible
# shutdown
# !
# interface MgmtEth0/0/CPU0/0
# ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
# description 'GigabitEthernet - 1"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
# description "GigabitEthernet - 2"
# bundle id 12 mode passive
# !
# interface GigabitEthernet0/0/0/3
# description "GigabitEthernet - 3"
# bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/4
# description "GigabitEthernet - 4"
# bundle id 12 mode passive
# !
#
- name: Gather IOSXR lag interfaces configuration
cisco.iosxr.iosxr_lag_interfaces:
config:
state: gathered
# --------------
# Output
# --------------
# gathered:
# - name: Bundle-Ether10
# members:
# - member: GigabitEthernet0/0/0/1
# mode: inherit
# - member: GigabitEthernet0/0/0/3
# mode: inherit
# mode: active
# links:
# max_active: 5
# min_active: 2
# load_balancing_hash: src-ip
# - name: Bundle-Ether12
# members:
# - member: GigabitEthernet0/0/0/2
# mode: passive
# - member: GigabitEthernet0/0/0/4
# mode: passive
# load_balancing_hash: dst-ip
# Using rendered:
- name: Render platform specific commands from task input using rendered state
cisco.iosxr.iosxr_lag_interfaces:
config:
- name: Bundle-Ether10
members:
- member: GigabitEthernet0/0/0/1
mode: inherit
- member: GigabitEthernet0/0/0/3
mode: inherit
mode: active
links:
max_active: 5
min_active: 2
load_balancing_hash: src-ip
- name: Bundle-Ether12
members:
- member: GigabitEthernet0/0/0/2
mode: passive
- member: GigabitEthernet0/0/0/4
mode: passive
load_balancing_hash: dst-ip
state: rendered
# Output:
# rendered:
# [
# - "interface Bundle-Ether10"
# - " lacp mode active"
# - " bundle load-balancing hash src-ip"
# - " bundle maximum-active links 5"
# - " bundle minimum-active links 2"
# - "interface Bundle-Ether12"
# - " bundle load-balancing hash dst-ip"
# - "interface Loopback888"
# - " description test for ansible"
# - " shutdown"
# - "interface MgmtEth0/0/CPU0/0"
# - " ipv4 address 192.0.2.11 255.255.255.0"
# - "interface GigabitEthernet0/0/0/1"
# - " description 'GigabitEthernet - 1""
# - " bundle id 10 mode inherit"
# - "interface GigabitEthernet0/0/0/2"
# - " description "GigabitEthernet - 2""
# - " bundle id 12 mode passive"
# - "interface GigabitEthernet0/0/0/3"
# - " description "GigabitEthernet - 3""
# - " bundle id 10 mode inherit"
# - "interface GigabitEthernet0/0/0/4"
# - " description "GigabitEthernet - 4""
# - " bundle id 12 mode passive"
# ]
#
返回值
常见返回值已记录在 此处,以下是此模块特有的字段
键 |
描述 |
---|---|
模块完成后配置作为结构化数据。 已返回:已更改时 示例: |
|
模块调用之前的配置作为结构化数据。 已返回:始终 示例: |
|
推送到远程设备的命令集。 已返回:始终 示例: |