cisco.ios.ios_static_routes 模块 – 配置静态路由的资源模块。
注意
此模块是 cisco.ios 集合 (版本 9.0.3) 的一部分。
如果您使用的是 ansible
包,则可能已安装此集合。它不包含在 ansible-core
中。要检查是否已安装它,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install cisco.ios
。
要在 playbook 中使用它,请指定: cisco.ios.ios_static_routes
。
cisco.ios 1.0.0 中的新增功能
概要
此模块配置和管理 IOS 平台上的静态路由。
参数
参数 |
注释 |
---|---|
静态路由选项的字典 |
|
用于静态路由的地址族 |
|
顶级地址族指示器。 选项
|
|
配置静态路由 |
|
带子网掩码的目标前缀 |
|
下一跳地址或接口 |
|
从 DHCP 获取默认网关 选项
|
|
此路由的距离度量 |
|
转发路由器的地址 |
|
下一跳地址是全局的 选项
|
|
直接连接静态路由的接口 |
|
多播路由 选项
|
|
指定下一跳的名称 |
|
永久路由 选项
|
|
设置此路由的标签 请参考厂商文档以了解有效值。 |
|
根据具有跟踪对象编号的跟踪项目安装路由。 跟踪不支持多播 请参考厂商文档以了解有效值。 |
|
单播路由(ipv6 特定) 选项
|
|
为拓扑路由/转发实例配置静态路由 注意,VRF 和拓扑只能与多播一起使用,并且拓扑应该在使用之前预先存在 |
|
IP VPN 路由/转发实例名称。 注意,对于 IPV4/IPV6,VRF 路由表应该在配置之前预先存在。 注意,如果没有提供 vrf 信息,则应在全局 vrf 下配置路由。 |
|
此选项仅与 state *parsed* 一起使用。 此选项的值应该是通过执行命令 **show running-config | include ip route|ipv6 route** 从 IOS 设备接收到的输出。 state *parsed* 从 |
|
配置应保留到的状态 状态 *rendered*、*gathered* 和 *parsed* 不会对设备进行任何更改。 状态 *rendered* 将 状态 *gathered* 将从设备获取运行配置,并将其转换为与资源模块 argspec 匹配的格式的结构化数据,并将值返回在结果中的 *gathered* 密钥中。 状态 *parsed* 从 选项
|
注释
注意
在 CML 上针对 Cisco IOS XE 版本 17.3 进行了测试。
此模块与连接
network_cli
一起使用。请参阅 https://docs.ansible.org.cn/ansible/latest/network/user_guide/platform_ios.html模块示例使用回调插件 (stdout_callback = yaml) 以 yaml 格式生成任务输出。
示例
# Using merged
# Before state:
# -------------
#
# vios#show running-config | include ip route|ipv6 route
- name: Merge provided configuration with device configuration
cisco.ios.ios_static_routes:
config:
- vrf: blue
address_families:
- afi: ipv4
routes:
- dest: 192.0.2.0/24
next_hops:
- forward_router_address: 192.0.2.1
name: merged_blue
tag: 50
track: 150
- address_families:
- afi: ipv4
routes:
- dest: 198.51.100.0/24
next_hops:
- forward_router_address: 198.51.101.1
name: merged_route_1
distance_metric: 110
tag: 40
multicast: true
- forward_router_address: 198.51.101.2
name: merged_route_2
distance_metric: 30
- forward_router_address: 198.51.101.3
name: merged_route_3
- afi: ipv6
routes:
- dest: 2001:DB8:0:3::/64
next_hops:
- forward_router_address: 2001:DB8:0:3::2
name: merged_v6
tag: 105
state: merged
# Task Output
# -----------
#
# before:
# - {}
# commands:
# - ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name merged_v6
# - ip route 198.51.100.0 255.255.255.0 198.51.101.1 110 tag 40 name merged_route_1 multicast
# - ip route 198.51.100.0 255.255.255.0 198.51.101.2 30 name merged_route_2
# - ip route 198.51.100.0 255.255.255.0 198.51.101.3 name merged_route_3
# - ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name merged_blue track 150
# after:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 198.51.100.0/24
# next_hops:
# - forward_router_address: 198.51.101.3
# name: merged_route_3
# - distance_metric: 30
# forward_router_address: 198.51.101.2
# name: merged_route_2
# - distance_metric: 110
# forward_router_address: 198.51.101.1
# multicast: true
# name: merged_route_1
# tag: 40
# - afi: ipv6
# routes:
# - dest: 2001:DB8:0:3::/64
# next_hops:
# - forward_router_address: 2001:DB8:0:3::2
# name: merged_v6
# tag: 105
# - address_families:
# - afi: ipv4
# routes:
# - dest: 192.0.2.0/24
# next_hops:
# - forward_router_address: 192.0.2.1
# name: merged_blue
# tag: 50
# track: 150
# vrf: blue
# After state:
# ------------
#
# vios#show running-config | include ip route|ipv6 route
# ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name merged_blue track 150
# ip route 198.51.100.0 255.255.255.0 198.51.101.3 name merged_route_3
# ip route 198.51.100.0 255.255.255.0 198.51.101.2 30 name merged_route_2
# ip route 198.51.100.0 255.255.255.0 198.51.101.1 110 tag 40 name merged_route_1 multicast
# ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name merged_v6
# Using replaced
# Before state:
# -------------
#
# vios#show running-config | include ip route|ipv6 route
# ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name merged_blue track 150
# ip route 198.51.100.0 255.255.255.0 198.51.101.3 name merged_route_3
# ip route 198.51.100.0 255.255.255.0 198.51.101.2 30 name merged_route_2
# ip route 198.51.100.0 255.255.255.0 198.51.101.1 110 tag 40 name merged_route_1 multicast
# ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name merged_v6
- name: Replace provided configuration with device configuration
cisco.ios.ios_static_routes:
config:
- address_families:
- afi: ipv4
routes:
- dest: 198.51.100.0/24
next_hops:
- forward_router_address: 198.51.101.1
name: replaced_route
distance_metric: 175
tag: 70
multicast: true
state: replaced
# Task Output
# -----------
#
# before:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 198.51.100.0/24
# next_hops:
# - forward_router_address: 198.51.101.3
# name: merged_route_3
# - distance_metric: 30
# forward_router_address: 198.51.101.2
# name: merged_route_2
# - distance_metric: 110
# forward_router_address: 198.51.101.1
# multicast: true
# name: merged_route_1
# tag: 40
# - afi: ipv6
# routes:
# - dest: 2001:DB8:0:3::/64
# next_hops:
# - forward_router_address: 2001:DB8:0:3::2
# name: merged_v6
# tag: 105
# - address_families:
# - afi: ipv4
# routes:
# - dest: 192.0.2.0/24
# next_hops:
# - forward_router_address: 192.0.2.1
# name: merged_blue
# tag: 50
# track: 150
# vrf: blue
# commands:
# - ip route 198.51.100.0 255.255.255.0 198.51.101.1 175 tag 70 name replaced_route multicast
# - no ip route 198.51.100.0 255.255.255.0 198.51.101.3 name merged_route_3
# - no ip route 198.51.100.0 255.255.255.0 198.51.101.2 30 name merged_route_2
# after:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 198.51.100.0/24
# next_hops:
# - distance_metric: 175
# forward_router_address: 198.51.101.1
# multicast: true
# name: replaced_route
# tag: 70
# - afi: ipv6
# routes:
# - dest: 2001:DB8:0:3::/64
# next_hops:
# - forward_router_address: 2001:DB8:0:3::2
# name: merged_v6
# tag: 105
# - address_families:
# - afi: ipv4
# routes:
# - dest: 192.0.2.0/24
# next_hops:
# - forward_router_address: 192.0.2.1
# name: merged_blue
# tag: 50
# track: 150
# vrf: blue
# After state:
# ------------
#
# vios#show running-config | include ip route|ipv6 route
# ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name merged_blue track 150
# ip route 198.51.100.0 255.255.255.0 198.51.101.1 175 tag 70 name replaced_route multicast
# ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name merged_v6
# Using overridden
# Before state:
# -------------
#
# vios#show running-config | include ip route|ipv6 route
# ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name merged_blue track 150
# ip route 198.51.100.0 255.255.255.0 198.51.101.1 175 tag 70 name replaced_route multicast
# ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name merged_v6
- name: Override provided configuration with device configuration
cisco.ios.ios_static_routes:
config:
- vrf: blue
address_families:
- afi: ipv4
routes:
- dest: 192.0.2.0/24
next_hops:
- forward_router_address: 192.0.2.1
name: override_vrf
tag: 50
track: 150
state: overridden
# Task Output
# -----------
#
# before:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 198.51.100.0/24
# next_hops:
# - distance_metric: 175
# forward_router_address: 198.51.101.1
# multicast: true
# name: replaced_route
# tag: 70
# - afi: ipv6
# routes:
# - dest: 2001:DB8:0:3::/64
# next_hops:
# - forward_router_address: 2001:DB8:0:3::2
# name: merged_v6
# tag: 105
# - address_families:
# - afi: ipv4
# routes:
# - dest: 192.0.2.0/24
# next_hops:
# - forward_router_address: 192.0.2.1
# name: merged_blue
# tag: 50
# track: 150
# vrf: blue
# commands:
# - ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name override_vrf track 150
# - no ip route 198.51.100.0 255.255.255.0 198.51.101.1 175 tag 70 name replaced_route multicast
# - no ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name merged_v6
# after:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 192.0.2.0/24
# next_hops:
# - forward_router_address: 192.0.2.1
# name: override_vrf
# tag: 50
# track: 150
# vrf: blue
# After state:
# ------------
#
# vios#show running-config | include ip route|ipv6 route
# ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name override_vrf track 150
# Using deleted
# Before state:
# -------------
# vios#show running-config | include ip route|ipv6 route
# ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name test_vrf track 150
# ip route 198.51.100.0 255.255.255.0 198.51.101.3 name route_3
# ip route 198.51.100.0 255.255.255.0 198.51.101.2 30 name route_2
# ip route 198.51.100.0 255.255.255.0 198.51.101.1 110 tag 40 name route_1 multicast
# ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name test_v6
- name: Delete the exact static routes, with all the static routes explicitly mentioned in want
cisco.ios.ios_static_routes:
config:
- vrf: blue
address_families:
- afi: ipv4
routes:
- dest: 192.0.2.0/24
next_hops:
- forward_router_address: 192.0.2.1
name: test_vrf
tag: 50
track: 150
- address_families:
- afi: ipv4
routes:
- dest: 198.51.100.0/24
next_hops:
- forward_router_address: 198.51.101.1
name: route_1
distance_metric: 110
tag: 40
multicast: true
- forward_router_address: 198.51.101.2
name: route_2
distance_metric: 30
- forward_router_address: 198.51.101.3
name: route_3
- afi: ipv6
routes:
- dest: 2001:DB8:0:3::/64
next_hops:
- forward_router_address: 2001:DB8:0:3::2
name: test_v6
tag: 105
state: deleted
# Task Output
# -----------
#
# before:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 198.51.100.0/24
# next_hops:
# - forward_router_address: 198.51.101.3
# name: route_3
# - distance_metric: 30
# forward_router_address: 198.51.101.2
# name: route_2
# - distance_metric: 110
# forward_router_address: 198.51.101.1
# multicast: true
# name: route_1
# tag: 40
# - afi: ipv6
# routes:
# - dest: 2001:DB8:0:3::/64
# next_hops:
# - forward_router_address: 2001:DB8:0:3::2
# name: test_v6
# tag: 105
# - address_families:
# - afi: ipv4
# routes:
# - dest: 192.0.2.0/24
# next_hops:
# - forward_router_address: 192.0.2.1
# name: test_vrf
# tag: 50
# track: 150
# vrf: blue
# commands:
# - no ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name test_vrf track 150
# - no ip route 198.51.100.0 255.255.255.0 198.51.101.3 name route_3
# - no ip route 198.51.100.0 255.255.255.0 198.51.101.2 30 name route_2
# - no ip route 198.51.100.0 255.255.255.0 198.51.101.1 110 tag 40 name route_1 multicast
# - no ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name test_v6
# after: {}
# After state:
# ------------
#
# vios#show running-config | include ip route|ipv6 route
# Using deleted - delete based on specific routes
# Before state:
# -------------
#
# vios#show running-config | include ip route|ipv6 route
# ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name test_vrf track 150
# ip route 198.51.100.0 255.255.255.0 198.51.101.3 name route_3
# ip route 198.51.100.0 255.255.255.0 198.51.101.2 30 name route_2
# ip route 198.51.100.0 255.255.255.0 198.51.101.1 110 tag 40 name route_1 multicast
# ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name test_v6
- name: Delete destination specific static routes
cisco.ios.ios_static_routes:
config:
- address_families:
- afi: ipv4
routes:
- dest: 198.51.100.0/24
state: deleted
# Task Output
# -----------
#
# before:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 198.51.100.0/24
# next_hops:
# - forward_router_address: 198.51.101.3
# name: route_3
# - distance_metric: 30
# forward_router_address: 198.51.101.2
# name: route_2
# - distance_metric: 110
# forward_router_address: 198.51.101.1
# multicast: true
# name: route_1
# tag: 40
# - afi: ipv6
# routes:
# - dest: 2001:DB8:0:3::/64
# next_hops:
# - forward_router_address: 2001:DB8:0:3::2
# name: test_v6
# tag: 105
# - address_families:
# - afi: ipv4
# routes:
# - dest: 192.0.2.0/24
# next_hops:
# - forward_router_address: 192.0.2.1
# name: test_vrf
# tag: 50
# track: 150
# vrf: blue
# commands:
# - no ip route 198.51.100.0 255.255.255.0 198.51.101.3 name route_3
# - no ip route 198.51.100.0 255.255.255.0 198.51.101.2 30 name route_2
# - no ip route 198.51.100.0 255.255.255.0 198.51.101.1 110 tag 40 name route_1 multicast
# after:
# - address_families:
# - afi: ipv6
# routes:
# - dest: 2001:DB8:0:3::/64
# next_hops:
# - forward_router_address: 2001:DB8:0:3::2
# name: test_v6
# tag: 105
# - address_families:
# - afi: ipv4
# routes:
# - dest: 192.0.2.0/24
# next_hops:
# - forward_router_address: 192.0.2.1
# name: test_vrf
# tag: 50
# track: 150
# vrf: blue
# After state:
# ------------
#
# vios#show running-config | include ip route|ipv6 route
# ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name test_vrf track 150
# ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name test_v6
# Using deleted - delete based on vrfs
# Before state:
# -------------
#
# vios#show running-config | include ip route|ipv6 route
# ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name test_vrf track 150
# ip route 198.51.100.0 255.255.255.0 198.51.101.3 name route_3
# ip route 198.51.100.0 255.255.255.0 198.51.101.2 30 name route_2
# ip route 198.51.100.0 255.255.255.0 198.51.101.1 110 tag 40 name route_1 multicast
# ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name test_v6
- name: Delete vrf specific static routes
cisco.ios.ios_static_routes:
config:
- vrf: blue
state: deleted
# Task Output
# -----------
#
# before:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 198.51.100.0/24
# next_hops:
# - forward_router_address: 198.51.101.3
# name: route_3
# - distance_metric: 30
# forward_router_address: 198.51.101.2
# name: route_2
# - distance_metric: 110
# forward_router_address: 198.51.101.1
# multicast: true
# name: route_1
# tag: 40
# - afi: ipv6
# routes:
# - dest: 2001:DB8:0:3::/64
# next_hops:
# - forward_router_address: 2001:DB8:0:3::2
# name: test_v6
# tag: 105
# - address_families:
# - afi: ipv4
# routes:
# - dest: 192.0.2.0/24
# next_hops:
# - forward_router_address: 192.0.2.1
# name: test_vrf
# tag: 50
# track: 150
# vrf: blue
# commands:
# - no ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name test_vrf track 150
# after:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 198.51.100.0/24
# next_hops:
# - forward_router_address: 198.51.101.3
# name: route_3
# - distance_metric: 30
# forward_router_address: 198.51.101.2
# name: route_2
# - distance_metric: 110
# forward_router_address: 198.51.101.1
# multicast: true
# name: route_1
# tag: 40
# - afi: ipv6
# routes:
# - dest: 2001:DB8:0:3::/64
# next_hops:
# - forward_router_address: 2001:DB8:0:3::2
# name: test_v6
# tag: 105
# After state:
# ------------
#
# vios#show running-config | include ip route|ipv6 route
# ip route 198.51.100.0 255.255.255.0 198.51.101.3 name route_3
# ip route 198.51.100.0 255.255.255.0 198.51.101.2 30 name route_2
# ip route 198.51.100.0 255.255.255.0 198.51.101.1 110 tag 40 name route_1 multicast
# ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name test_v6
# Using deleted - delete all
# Before state:
# -------------
#
# vios#show running-config | include ip route|ipv6 route
# ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name test_vrf track 150
# ip route 198.51.100.0 255.255.255.0 198.51.101.3 name route_3
# ip route 198.51.100.0 255.255.255.0 198.51.101.2 30 name route_2
# ip route 198.51.100.0 255.255.255.0 198.51.101.1 110 tag 40 name route_1 multicast
# ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name test_v6
- name: Delete ALL configured static routes
cisco.ios.ios_static_routes:
state: deleted
# Task Output
# -----------
#
# before:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 198.51.100.0/24
# next_hops:
# - forward_router_address: 198.51.101.3
# name: route_3
# - distance_metric: 30
# forward_router_address: 198.51.101.2
# name: route_2
# - distance_metric: 110
# forward_router_address: 198.51.101.1
# multicast: true
# name: route_1
# tag: 40
# - afi: ipv6
# routes:
# - dest: 2001:DB8:0:3::/64
# next_hops:
# - forward_router_address: 2001:DB8:0:3::2
# name: test_v6
# tag: 105
# - address_families:
# - afi: ipv4
# routes:
# - dest: 192.0.2.0/24
# next_hops:
# - forward_router_address: 192.0.2.1
# name: test_vrf
# tag: 50
# track: 150
# vrf: blue
# commands:
# - no ip route 198.51.100.0 255.255.255.0 198.51.101.3 name route_3
# - no ip route 198.51.100.0 255.255.255.0 198.51.101.2 30 name route_2
# - no ip route 198.51.100.0 255.255.255.0 198.51.101.1 110 tag 40 name route_1 multicast
# - no ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name test_v6
# - no ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name test_vrf track 150
# after: {}
# After state:
# -------------
#
# vios#show running-config | include ip route|ipv6 route
# Using gathered
# Before state:
# -------------
#
# vios#show running-config | include ip route|ipv6 route
# ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name test_vrf track 150
# ip route 198.51.100.0 255.255.255.0 198.51.101.3 name route_3
# ip route 198.51.100.0 255.255.255.0 198.51.101.2 30 name route_2
# ip route 198.51.100.0 255.255.255.0 198.51.101.1 110 tag 40 name route_1 multicast
# ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name test_v6
- name: Gather facts of static routes
cisco.ios.ios_static_routes:
config:
state: gathered
# Task Output
# -----------
#
# gathered:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 198.51.100.0/24
# next_hops:
# - forward_router_address: 198.51.101.3
# name: route_3
# - distance_metric: 30
# forward_router_address: 198.51.101.2
# name: route_2
# - distance_metric: 110
# forward_router_address: 198.51.101.1
# multicast: true
# name: route_1
# tag: 40
# - afi: ipv6
# routes:
# - dest: 2001:DB8:0:3::/64
# next_hops:
# - forward_router_address: 2001:DB8:0:3::2
# name: test_v6
# tag: 105
# - address_families:
# - afi: ipv4
# routes:
# - dest: 192.0.2.0/24
# next_hops:
# - forward_router_address: 192.0.2.1
# name: test_vrf
# tag: 50
# track: 150
# vrf: blue
# Using rendered
- name: Render the commands for provided configuration
cisco.ios.ios_static_routes:
config:
- vrf: blue
address_families:
- afi: ipv4
routes:
- dest: 192.0.2.0/24
next_hops:
- forward_router_address: 192.0.2.1
name: test_vrf
tag: 50
track: 150
- address_families:
- afi: ipv4
routes:
- dest: 198.51.100.0/24
next_hops:
- forward_router_address: 198.51.101.1
name: route_1
distance_metric: 110
tag: 40
multicast: true
- forward_router_address: 198.51.101.2
name: route_2
distance_metric: 30
- forward_router_address: 198.51.101.3
name: route_3
- afi: ipv6
routes:
- dest: 2001:DB8:0:3::/64
next_hops:
- forward_router_address: 2001:DB8:0:3::2
name: test_v6
tag: 105
state: rendered
# Task Output
# -----------
#
# rendered:
# - ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name test_vrf track 150
# - ip route 198.51.100.0 255.255.255.0 198.51.101.1 110 tag 40 name route_1 multicast
# - ip route 198.51.100.0 255.255.255.0 198.51.101.2 30 name route_2
# - ip route 198.51.100.0 255.255.255.0 198.51.101.3 name route_3
# - ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name test_v6
# Using parsed
# File: parsed.cfg
# ----------------
#
# ip route vrf blue 192.0.2.0 255.255.255.0 192.0.2.1 tag 50 name test_vrf track 150
# ip route 198.51.100.0 255.255.255.0 198.51.101.3 name route_3
# ip route 198.51.100.0 255.255.255.0 198.51.101.2 30 name route_2
# ip route 198.51.100.0 255.255.255.0 198.51.101.1 110 tag 40 name route_1 multicast
# ipv6 route 2001:DB8:0:3::/64 2001:DB8:0:3::2 tag 105 name test_v6
- name: Parse the provided configuration
cisco.ios.ios_static_routes:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Task Output
# -----------
#
# parsed:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 198.51.100.0/24
# next_hops:
# - forward_router_address: 198.51.101.3
# name: route_3
# - distance_metric: 30
# forward_router_address: 198.51.101.2
# name: route_2
# - distance_metric: 110
# forward_router_address: 198.51.101.1
# multicast: true
# name: route_1
# tag: 40
# - afi: ipv6
# routes:
# - dest: 2001:DB8:0:3::/64
# next_hops:
# - forward_router_address: 2001:DB8:0:3::2
# name: test_v6
# tag: 105
# - address_families:
# - afi: ipv4
# routes:
# - dest: 192.0.2.0/24
# next_hops:
# - forward_router_address: 192.0.2.1
# name: test_vrf
# tag: 50
# track: 150
# vrf: blue
返回值
常见的返回值已记录在 此处,以下是此模块独有的字段
键 |
描述 |
---|---|
模块完成后的结构化数据配置。 返回:已更改时 示例: |
|
模块调用之前的结构化数据配置。 返回值: 始终 示例: |
|
推送到远程设备的命令集 返回值: 始终 示例: |
|
从远程主机获取的运行配置转换后的结构化数据配置 返回值: 当 示例: |
|
返回值: 当 示例: |
|
根据 返回值: 当 示例: |