cisco.iosxr.iosxr_vrf_global 模块 – 管理全局 VRF 配置。
注意
此模块是 cisco.iosxr 集合 (版本 10.2.2) 的一部分。
如果您使用的是 ansible
软件包,则可能已安装此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install cisco.iosxr
。
要在剧本中使用它,请指定: cisco.iosxr.iosxr_vrf_global
。
cisco.iosxr 9.0.0 中的新增功能
概要
此模块管理 Cisco IOS-XR 设备上的 VRF 配置。
它使剧本能够处理单个 VRF 或完整的 VRF 集合。
它还允许从设置中删除未明确声明的 VRF 定义。
参数
参数 |
注释 |
---|---|
VRF 配置的选项字典。 |
|
VRF 的描述。 |
|
用于同步 VRF 路由的 EVPN 实例 VPN ID。 |
|
回退 VRF 名称 |
|
多播主机堆栈选项 |
|
地址族标识符 (AFI) 选项
|
|
多播的默认接口。 |
|
VRF 的名称。 |
|
VPN 路由区分符 (RD)。 |
|
启用/禁用每个 VRF 的远程路由过滤 |
|
禁用每个 VRF 的远程路由过滤 选项
|
|
VRF 的 VPN ID |
|
VRF 的 VPN ID。 |
|
此选项仅与状态 *parsed* 一起使用。 此选项的值应是从 IOS-XR 设备执行命令 **show running-config vrf** 收到的输出。 状态 *parsed* 从 |
|
配置应保留的状态 状态 *rendered*、*gathered* 和 *parsed* 不会对设备进行任何更改。 状态 *rendered* 将 状态 *gathered* 将获取设备的运行配置,并根据资源模块 argspec 将其转换为结构化数据,并将该值返回结果中的 *gathered* 键中。 状态 *parsed* 从 状态 *purged* 从目标设备中删除所有 VRF 配置。谨慎使用此状态。 状态 *deleted* 只删除此模块管理的 VRF 属性,不会完全否定 VRF。从而保留 VRF 上下文中与地址族相关的配置。 有关更多详细信息,请参阅示例。 选项
|
备注
注意
针对 Cisco IOS-XR 版本 9.0.0 进行测试
此模块使用连接
network_cli
。参见 IOS_XR 平台选项。
模块示例使用回调插件 (stdout_callback = yaml) 以 yaml 格式生成任务输出。
示例
# Using merged
#
# Before state:
# -------------
#
# RP/0/0/CPU0:iosxr-02#show running-config vrf
# Fri Feb 9 07:02:35.789 UTC
# !
# vrf test
#
- name: Merge provided configuration with device configuration
cisco.iosxr.iosxr_vrf_global:
config:
- name: VRF4
description: VRF4 Description
evpn_route_sync: 793
fallback_vrf: "test-vrf"
remote_route_filtering:
disable: "true"
rd: "3:4"
mhost:
afi: "ipv4"
default_interface: "Loopback0"
vpn:
id: "2:3"
state: merged
# Task Output:
# ------------
#
# before: []
#
# commands:
# - vrf VRF4
# - description VRF4 Description
# - evpn-route-sync 793
# - fallback-vrf test-vrf
# - mhost ipv4 default-interface Loopback0
# - rd 3:4
# - remote-route-filtering disable
# - vpn id 2:3
#
# after:
# - name: VRF4
# description: VRF4 Description
# evpn_route_sync: 793
# fallback_vrf: "test-vrf"
# mhost:
# afi: "ipv4"
# default_interface: "Loopback0"
# rd: "3:4"
# remote_route_filtering:
# disable: "true"
# vpn:
# id: "2:3"
#
# After state:
# ------------
#
# RP/0/0/CPU0:iosxr-02#show running-config vrf
# Sat Feb 20 03:49:43.618 UTC
# vrf VRF4
# description "VRF4 Description"
# mhost ipv4 default-interface Loopback0
# evpn-route-sync 793
# vpn id 2:3
# fallback-vrf "test-vrf"
# remote-route-filtering disable
# rd "3:4"
# Using replaced
#
# Before state:
# -------------
#
# RP/0/0/CPU0:iosxr-02#show running-config vrf
# Sat Feb 20 03:49:43.618 UTC
# vrf VRF4
# description "VRF4 Description"
# mhost ipv4 default-interface Loopback0
# evpn-route-sync 793
# vpn id 2:3
# fallback-vrf "test-vrf"
# remote-route-filtering disable
# rd "3:4"
- name: Replace the provided configuration with the existing running configuration
cisco.iosxr.iosxr_vrf_global:
config:
- name: VRF7
description: VRF7 description
evpn_route_sync: 398
fallback_vrf: "replaced-vrf"
remote_route_filtering:
disable: "true"
rd: "67:9"
mhost:
afi: "ipv4"
default_interface: "Loopback0"
vpn:
id: "4:5"
state: replaced
# Task Output:
# ------------
#
# before:
# - name: VRF4
# description: VRF4 Description
# evpn_route_sync: 793
# fallback_vrf: "test-vrf"
# mhost:
# afi: "ipv4"
# default_interface: "Loopback0"
# rd: "3:4"
# remote_route_filtering:
# disable: "true"
# vpn:
# id: "2:3"
#
# commands:
# - vrf VRF4
# - no vpn id 2:3
# - vrf VRF7
# - description VRF7 description
# - evpn-route-sync 398
# - fallback-vrf replaced-vrf
# - mhost ipv4 default-interface Loopback0
# - rd 6:9
# - remote-route-filtering disable
# - vpn id 4:5
#
# after:
# - name: VRF4
# description: VRF4 Description
# evpn_route_sync: 793
# fallback_vrf: "test-vrf"
# mhost:
# afi: "ipv4"
# default_interface: "Loopback0"
# rd: "3:4"
# remote_route_filtering:
# disable: "true"
# - name: VRF7
# description: VRF7 description
# evpn_route_sync: 398
# fallback_vrf: "replaced-vrf"
# remote_route_filtering:
# disable: true
# rd: "67:9"
# mhost:
# afi: "ipv4"
# default_interface: "Loopback0"
# vpn:
# id: "4:5"
#
# After state:
# ------------
#
# RP/0/RP0/CPU0:ios(config)#show running-config vrf
# Sun Mar 10 16:48:53.204 UTC
# vrf VRF4
# mhost ipv4 default-interface Loopback0
# evpn-route-sync 793
# description VRF4 Description
# fallback-vrf test-vrf
# remote-route-filtering disable
# rd 3:4
# !
# vrf VRF7
# mhost ipv4 default-interface Loopback0
# evpn-route-sync 398
# description VRF7 description
# vpn id 4:5
# fallback-vrf replaced-vrf
# remote-route-filtering disable
# rd 67:9
# !
# !
# Using overridden
#
# Before state:
# -------------
#
# RP/0/RP0/CPU0:ios(config)#show running-config vrf
# Sun Mar 10 16:48:53.204 UTC
# vrf VRF4
# mhost ipv4 default-interface Loopback0
# evpn-route-sync 793
# description VRF4 Description
# fallback-vrf test-vrf
# remote-route-filtering disable
# rd 3:4
# !
# !
# vrf VRF7
# mhost ipv4 default-interface Loopback0
# evpn-route-sync 398
# description VRF7 description
# vpn id 4:5
# fallback-vrf replaced-vrf
# remote-route-filtering disable
# rd 67:9
# !
# !
- name: Override the provided configuration with the existing running configuration
cisco.iosxr.iosxr_vrf_global:
state: overridden
config:
- name: VRF6
description: VRF6 Description
evpn_route_sync: 101
fallback_vrf: "overridden-vrf"
remote_route_filtering:
disable: "true"
rd: "9:8"
mhost:
afi: "ipv4"
default_interface: "Loopback0"
vpn:
id: "23:3"
# Task Output:
# ------------
#
# before:
# - name: VRF4
# description: VRF4 Description
# evpn_route_sync: 793
# fallback_vrf: "test-vrf"
# mhost:
# afi: "ipv4"
# default_interface: "Loopback0"
# rd: "3:4"
# remote_route_filtering:
# disable: "true"
# - name: VRF7
# description: VRF7 description
# evpn_route_sync: 398
# fallback_vrf: "replaced-vrf"
# remote_route_filtering:
# disable: true
# rd: "67:9"
# mhost:
# afi: "ipv4"
# default_interface: "Loopback0"
# vpn:
# id: "4:5"
#
# commands:
# - vrf VRF4
# - no description VRF4 Description
# - no evpn-route-sync 793
# - no fallback-vrf test-vrf
# - no mhost ipv4 default-interface Loopback0
# - no rd 3:4
# - no remote-route-filtering disable
# - vrf VRF7
# - no description VRF7 description
# - no evpn-route-sync 398
# - no fallback-vrf replaced-vrf
# - no mhost ipv4 default-interface Loopback0
# - no rd 67:9
# - no remote-route-filtering disable
# - no vpn id 4:5
# - vrf VRF6
# - description VRF6 Description
# - evpn-route-sync 101
# - fallback-vrf overridden-vrf
# - mhost ipv4 default-interface Loopback0
# - rd 9:8
# - remote-route-filtering disable
# - vpn id 23:3
#
# after:
# - name: VRF4
# - name: VRF6
# description: VRF6 Description
# evpn_route_sync: 101
# fallback_vrf: "overridden-vrf"
# remote_route_filtering:
# disable: "true"
# rd: "9:8"
# mhost:
# afi: "ipv4"
# default_interface: "Loopback0"
# vpn:
# id: "23:3"
# - name: VRF7
#
# After state:
# -------------
# RP/0/RP0/CPU0:ios(config)#show running-config vrf
# Sun Mar 10 16:54:53.007 UTC
# vrf VRF4
# vrf VRF6
# mhost ipv4 default-interface Loopback0
# evpn-route-sync 101
# description VRF6 Description
# vpn id 23:3
# fallback-vrf overridden-vrf
# remote-route-filtering disable
# rd 9:8
# vrf VRF7
# Using deleted
#
# Before state:
# -------------
#
# RP/0/RP0/CPU0:ios(config)#show running-config vrf
# Sun Mar 10 16:54:53.007 UTC
# vrf VRF4
# vrf VRF6
# mhost ipv4 default-interface Loopback0
# evpn-route-sync 101
# description VRF6 Description
# vpn id 23:3
# fallback-vrf overridden-vrf
# remote-route-filtering disable
# rd 9:8
# vrf VRF7
- name: Delete the provided configuration
cisco.iosxr.iosxr_vrf_global:
config:
state: deleted
# Task Output:
# ------------
#
# before:
# - name: VRF4
# - name: VRF6
# description: VRF6 Description
# evpn_route_sync: 101
# fallback_vrf: "overridden-vrf"
# remote_route_filtering:
# disable: "true"
# rd: "9:8"
# mhost:
# afi: "ipv4"
# default_interface: "Loopback0"
# vpn:
# id: "23:3"
# - name: VRF7
# commands:
# - vrf VRF4
# - vrf VRF6
# - no description VRF6 Description
# - no evpn-route-sync 101
# - no fallback-vrf overridden-vrf
# - no mhost ipv4 default-interface Loopback0
# - no rd 9:8
# - no remote-route-filtering disable
# - no vpn id 23:3
# - vrf VRF7
#
# after:
# - name: VRF4
# - name: VRF6
# - name: VRF7
#
# After state:
# ------------
#
# RP/0/RP0/CPU0:ios(config)#show running-config vrf
# Sun Mar 10 17:02:38.981 UTC
# vrf VRF4
# vrf VRF6
# vrf VRF7
# Using purged
#
# Before state:
# -------------
#
# RP/0/RP0/CPU0:ios(config)#show running-config vrf
# vrf VRF4
# vrf VRF6
# vrf VRF7
- name: Purge all the configuration from the device
cisco.iosxr.iosxr_vrf_global:
state: purged
# Task Output:
# ------------
#
# before:
# - name: VRF4
# - name: VRF6
# - name: VRF7
#
# commands:
# - no vrf VRF4
# - no vrf VRF6
# - no vrf VRF7
#
# after: []
#
# After state:
# -------------
# RP/0/RP0/CPU0:ios(config)#show running-config vrf
# Sun Mar 10 17:02:38.981 UTC
# -
# Using rendered
#
- name: Render provided configuration with device configuration
cisco.iosxr.iosxr_vrf_global:
config:
- name: VRF4
description: VRF4 Description
evpn_route_sync: 793
fallback_vrf: "test-vrf"
remote_route_filtering:
disable: "true"
rd: "3:4"
mhost:
afi: "ipv4"
default_interface: "Loopback0"
vpn:
id: "2:3"
state: rendered
# Task Output:
# ------------
#
# rendered:
# - vrf VRF4
# - description VRF4 Description
# - evpn-route-sync 793
# - fallback-vrf test-vrf
# - mhost ipv4 default-interface Loopback0
# - rd 3:4
# - remote-route-filtering disable
# - vpn id 2:3
# Using gathered
#
# Before state:
# -------------
#
# RP/0/RP0/CPU0:ios(config)#show running-config vrf
# Sun Mar 10 17:02:38.981 UTC
# vrf VRF4
# description "VRF4 Description"
# mhost ipv4 default-interface Loopback0
# evpn-route-sync 793
# vpn id 2:3
# fallback-vrf "test-vrf"
# remote-route-filtering disable
# rd "3:4"
- name: Gather existing running configuration
cisco.iosxr.iosxr_vrf_global:
state: gathered
# Task Output:
# ------------
#
# gathered:
# - name: VRF4
# description: VRF4 Description
# evpn_route_sync: 793
# fallback_vrf: "test-vrf"
# mhost:
# afi: "ipv4"
# default_interface: "Loopback0"
# rd: "3:4"
# remote_route_filtering:
# disable: "true"
# vpn:
# id: "2:3"
# Using parsed
#
# File: parsed.cfg
# ----------------
#
# vrf test
# description "This is test VRF"
# mhost ipv4 default-interface Loopback0
# evpn-route-sync 456
# vpn id 56
# fallback-vrf "test-vrf"
# remote-route-filtering disable
# rd "testing"
# !
# !
# vrf my_vrf
# mhost ipv4 default-interface Loopback0
# evpn-route-sync 235
# description "this is sample vrf for feature testing"
# fallback-vrf "parsed-vrf"
# rd "2:3"
# remote-route-filtering disable
# vpn id 23
# !
# !
- name: Parse the provided configuration
cisco.iosxr.iosxr_vrf_global:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Task Output:
# ------------
#
# parsed:
# - description: This is test VRF
# evpn_route_sync: 456
# fallback_vrf: test-vrf
# mhost:
# afi: ipv4
# default_interface: Loopback0
# name: test
# rd: testing
# remote_route_filtering:
# disable: true
# vpn:
# id: '56'
# - description: this is sample vrf for feature testing
# evpn_route_sync: 235
# fallback_vrf: parsed-vrf
# mhost:
# afi: ipv4
# default_interface: Loopback0
# name: my_vrf
# rd: '2:3'
# remote_route_filtering:
# disable: true
# vpn:
# id: '23'
返回值
常见的返回值已在此处记录 这里,以下是此模块特有的字段
键 |
描述 |
---|---|
生成的配置模型调用。 返回:发生更改时 示例: |
|
模型调用之前的配置。 返回:始终返回 示例: |
|
推送到远程设备的命令集。 返回:始终返回 示例: |
|
从远程设备收集的关于网络资源的事实,作为结构化数据。 返回:当 *state* 为 示例: |
|
根据模块argspec,将running_config选项中提供的设备原生配置解析为结构化数据。 返回:当state为 示例: |
|
在任务中提供的配置以设备原生格式(离线)渲染。 返回:当state为 示例: |