vyos.vyos.vyos_ospfv2 模块 – OSPFv2 资源模块
注意
此模块是 vyos.vyos 集合 (版本 5.0.0) 的一部分。
如果您正在使用 ansible
包,则可能已安装此集合。它不包含在 ansible-core
中。要检查它是否已安装,请运行 ansible-galaxy collection list
。
要安装它,请使用:ansible-galaxy collection install vyos.vyos
。
要在 playbook 中使用它,请指定:vyos.vyos.vyos_ospfv2
。
vyos.vyos 1.0.0 中的新增功能
概要
此资源模块配置和管理 VyOS 网络设备上 OSPFv2 路由的属性。
参数
参数 |
注释 |
---|---|
提供的 OSPFv2 路由配置。 |
|
OSPFv2 区域。 |
|
OSPFv2 区域标识。 |
|
区域类型。 |
|
普通 OSPFv2 区域。 选项
|
|
NSSA OSPFv2 区域。 |
|
NSSA 区域的默认成本摘要。 |
|
不要将区域间路由注入存根。 选项
|
|
启用 NSSA。 选项
|
|
NSSA-ABR。 选项
|
|
存根 OSPFv2 区域。 |
|
存根区域的默认成本摘要。 |
|
不要将区域间路由注入存根。 选项
|
|
启用存根。 选项
|
|
OSPFv2 区域认证类型。 选项
|
|
OSPFv2 网络。 |
|
OSPFv2 IPv4 网络地址。 |
|
汇总匹配前缀的路由(仅限边界路由器)。 |
|
边界路由器 IPv4 地址。 |
|
此范围的度量。 |
|
不要通告此范围。 选项
|
|
将区域范围(IPv4 地址)通告为另一个前缀。 |
|
区域的快捷方式模式。 选项
|
|
虚拟链路地址。 |
|
虚拟链路地址。 |
|
OSPFv2 区域认证类型。 |
|
基于 MD5 密钥 ID 的身份验证。 |
|
MD5 密钥 ID。 |
|
MD5 密钥。 |
|
纯文本密码。 |
|
声明邻居失效后的时间间隔。 |
|
Hello 数据包之间的时间间隔。 |
|
重新传输丢失的链路状态通告之间的时间间隔。 |
|
链路状态传输延迟。 |
|
根据带宽计算 OSPFv2 接口成本。 |
|
参考带宽成本(Mbit/秒)。 |
|
控制默认信息的分配。 |
|
分发默认路由。 |
|
始终通告默认路由。 选项
|
|
OSPFv2 默认度量。 |
|
默认路由的 OSPFv2 度量类型。 |
|
路由映射引用。 |
|
重新分发路由的度量 |
|
管理距离。 |
|
全局 OSPFv2 管理距离。 |
|
OSPFv2 管理距离。 |
|
外部路由的距离。 |
|
区域间路由的距离。 |
|
区域内路由的距离。 |
|
记录邻接状态的变化。 选项
|
|
OSPFv2 最大/无限距离度量。 |
|
使用无限距离通告自己的路由器 LSA(存根路由器)。 |
|
管理上应用,无限期。 选项
|
|
通告自身为存根路由器的时间。 |
|
通告自身为存根路由器的时间 |
|
多协议标签交换-流量工程 (MPLS-TE) 参数。 |
|
启用 MPLS-TE 功能。 选项
|
|
通告路由器的稳定 IP 地址。 |
|
邻居 IP 地址。 |
|
邻居的标识(编号/IP 地址)。 |
|
失效邻居轮询间隔之间的秒数。 |
|
邻居优先级。 |
|
OSPFv2 特定参数。 |
|
OSPFv2 ABR 类型。 选项
|
|
启用不透明 LSA 功能 (rfc2370)。 选项
|
|
启用用于处理 AS 外部路由的 rfc1583 标准。 选项
|
|
覆盖默认路由器标识符。 |
|
抑制接口上的路由更新。 |
|
使用 passive-interface default 时要排除的接口。 |
|
重新分发来自其他路由协议的信息。 |
|
重新分发路由的度量。 |
|
OSPFv2 度量类型。 |
|
路由映射引用。 |
|
要重新分发的路由类型。 选项
|
|
过滤在本地路由映射中安装的路由。 |
|
调整路由计时器。 |
|
调整刷新参数。 |
|
刷新计时器。 |
|
限制自适应计时器。 |
|
OSPFv2 SPF 计时器。 |
|
从收到第一个更改到执行 SPF 计算的延迟(毫秒)。 |
|
连续 SPF 计算之间的初始保持时间(毫秒)。 |
|
最大保持时间(秒)。 |
|
此选项仅在状态为 *parsed* 时使用。 此选项的值应为通过执行命令 **show configuration commands | grep ospf** 从 VyOS 设备接收到的输出。 状态parsed从 |
|
配置应保留的状态。 选项
|
备注
注意
已在 VyOS 1.1.8 (helium) 上测试。
此模块与连接
ansible.netcommon.network_cli
一起使用。请参见VyOS 操作系统平台选项。
示例
# Using merged
#
# Before state:
# -------------
#
# vyos@vyos# run show configuration commands | grep ospf
#
#
- name: Merge the provided configuration with the existing running configuration
vyos.vyos.vyos_ospfv2:
config:
log_adjacency_changes: detail
max_metric:
router_lsa:
administrative: true
on_shutdown: 10
on_startup: 10
default_information:
originate:
always: true
metric: 10
metric_type: 2
route_map: ingress
mpls_te:
enabled: true
router_address: 192.0.11.11
auto_cost:
reference_bandwidth: 2
neighbor:
- neighbor_id: 192.0.11.12
poll_interval: 10
priority: 2
redistribute:
- route_type: bgp
metric: 10
metric_type: 2
passive_interface:
- eth1
- eth2
parameters:
router_id: 192.0.1.1
opaque_lsa: true
rfc1583_compatibility: true
abr_type: cisco
areas:
- area_id: '2'
area_type:
normal: true
authentication: plaintext-password
shortcut: enable
- area_id: '3'
area_type:
nssa:
set: true
- area_id: '4'
area_type:
stub:
default_cost: 20
network:
- address: 192.0.2.0/24
range:
- address: 192.0.3.0/24
cost: 10
- address: 192.0.4.0/24
cost: 12
state: merged
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# before": {}
#
# "commands": [
# "set protocols ospf mpls-te enable",
# "set protocols ospf mpls-te router-address '192.0.11.11'",
# "set protocols ospf redistribute bgp",
# "set protocols ospf redistribute bgp metric-type 2",
# "set protocols ospf redistribute bgp metric 10",
# "set protocols ospf default-information originate metric-type 2",
# "set protocols ospf default-information originate always",
# "set protocols ospf default-information originate metric 10",
# "set protocols ospf default-information originate route-map ingress",
# "set protocols ospf auto-cost reference-bandwidth '2'",
# "set protocols ospf parameters router-id '192.0.1.1'",
# "set protocols ospf parameters opaque-lsa",
# "set protocols ospf parameters abr-type 'cisco'",
# "set protocols ospf parameters rfc1583-compatibility",
# "set protocols ospf passive-interface eth1",
# "set protocols ospf passive-interface eth2",
# "set protocols ospf max-metric router-lsa on-shutdown 10",
# "set protocols ospf max-metric router-lsa administrative",
# "set protocols ospf max-metric router-lsa on-startup 10",
# "set protocols ospf log-adjacency-changes 'detail'",
# "set protocols ospf neighbor 192.0.11.12 priority 2",
# "set protocols ospf neighbor 192.0.11.12 poll-interval 10",
# "set protocols ospf neighbor 192.0.11.12",
# "set protocols ospf area '2'",
# "set protocols ospf area 2 authentication plaintext-password",
# "set protocols ospf area 2 shortcut enable",
# "set protocols ospf area 2 area-type normal",
# "set protocols ospf area '3'",
# "set protocols ospf area 3 area-type nssa",
# "set protocols ospf area 4 range 192.0.3.0/24 cost 10",
# "set protocols ospf area 4 range 192.0.3.0/24",
# "set protocols ospf area 4 range 192.0.4.0/24 cost 12",
# "set protocols ospf area 4 range 192.0.4.0/24",
# "set protocols ospf area 4 area-type stub default-cost 20",
# "set protocols ospf area '4'",
# "set protocols ospf area 4 network 192.0.2.0/24"
# ]
#
# "after": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
# Using merged
#
# Before state:
# -------------
#
# vyos@vyos# run show configuration commands | grep ospf
#
#
- name: Merge the provided configuration to update existing running configuration
vyos.vyos.vyos_ospfv2:
config:
areas:
- area_id: '2'
area_type:
normal: true
authentication: plaintext-password
shortcut: enable
- area_id: '3'
area_type:
nssa:
set: false
- area_id: '4'
area_type:
stub:
default_cost: 20
network:
- address: 192.0.2.0/24
- address: 192.0.22.0/24
- address: 192.0.32.0/24
state: merged
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# "commands": [
# "delete protocols ospf area 4 area-type stub",
# "set protocols ospf area 4 network 192.0.22.0/24"
# "set protocols ospf area 4 network 192.0.32.0/24"
# ]
#
# "after": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# },
# {
# "address": "192.0.22.0/24"
# },
# {
# "address": "192.0.32.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 network '192.0.22.0/24'
# set protocols ospf area 4 network '192.0.32.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
# Using replaced
#
# Before state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
#
- name: Replace ospfv2 routes attributes configuration.
vyos.vyos.vyos_ospfv2:
config:
log_adjacency_changes: detail
max_metric:
router_lsa:
administrative: true
on_shutdown: 10
on_startup: 10
default_information:
originate:
always: true
metric: 10
metric_type: 2
route_map: ingress
mpls_te:
enabled: true
router_address: 192.0.22.22
auto_cost:
reference_bandwidth: 2
neighbor:
- neighbor_id: 192.0.11.12
poll_interval: 10
priority: 2
redistribute:
- route_type: bgp
metric: 10
metric_type: 2
passive_interface:
- eth1
parameters:
router_id: 192.0.1.1
opaque_lsa: true
rfc1583_compatibility: true
abr_type: cisco
areas:
- area_id: '2'
area_type:
normal: true
authentication: plaintext-password
shortcut: enable
- area_id: '4'
area_type:
stub:
default_cost: 20
network:
- address: 192.0.2.0/24
- address: 192.0.12.0/24
- address: 192.0.22.0/24
- address: 192.0.32.0/24
range:
- address: 192.0.42.0/24
cost: 10
state: replaced
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "before": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# "commands": [
# "delete protocols ospf passive-interface eth2",
# "delete protocols ospf area 3",
# "delete protocols ospf area 4 range 192.0.3.0/24 cost",
# "delete protocols ospf area 4 range 192.0.3.0/24",
# "delete protocols ospf area 4 range 192.0.4.0/24 cost",
# "delete protocols ospf area 4 range 192.0.4.0/24",
# "set protocols ospf mpls-te router-address '192.0.22.22'",
# "set protocols ospf area 4 range 192.0.42.0/24 cost 10",
# "set protocols ospf area 4 range 192.0.42.0/24",
# "set protocols ospf area 4 network 192.0.12.0/24",
# "set protocols ospf area 4 network 192.0.22.0/24",
# "set protocols ospf area 4 network 192.0.32.0/24"
# ]
#
# "after": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.12.0/24"
# },
# {
# "address": "192.0.2.0/24"
# },
# {
# "address": "192.0.22.0/24"
# },
# {
# "address": "192.0.32.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.42.0/24",
# "cost": 10
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.22.22"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 network '192.0.12.0/24'
# set protocols ospf area 4 network '192.0.22.0/24'
# set protocols ospf area 4 network '192.0.32.0/24'
# set protocols ospf area 4 range 192.0.42.0/24 cost '10'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.22.22'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
# Using rendered
#
#
- name: Render the commands for provided configuration
vyos.vyos.vyos_ospfv2:
config:
log_adjacency_changes: detail
max_metric:
router_lsa:
administrative: true
on_shutdown: 10
on_startup: 10
default_information:
originate:
always: true
metric: 10
metric_type: 2
route_map: ingress
mpls_te:
enabled: true
router_address: 192.0.11.11
auto_cost:
reference_bandwidth: 2
neighbor:
- neighbor_id: 192.0.11.12
poll_interval: 10
priority: 2
redistribute:
- route_type: bgp
metric: 10
metric_type: 2
passive_interface:
- eth1
- eth2
parameters:
router_id: 192.0.1.1
opaque_lsa: true
rfc1583_compatibility: true
abr_type: cisco
areas:
- area_id: '2'
area_type:
normal: true
authentication: plaintext-password
shortcut: enable
- area_id: '3'
area_type:
nssa:
set: true
- area_id: '4'
area_type:
stub:
default_cost: 20
network:
- address: 192.0.2.0/24
range:
- address: 192.0.3.0/24
cost: 10
- address: 192.0.4.0/24
cost: 12
state: rendered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "rendered": [
# [
# "set protocols ospf mpls-te enable",
# "set protocols ospf mpls-te router-address '192.0.11.11'",
# "set protocols ospf redistribute bgp",
# "set protocols ospf redistribute bgp metric-type 2",
# "set protocols ospf redistribute bgp metric 10",
# "set protocols ospf default-information originate metric-type 2",
# "set protocols ospf default-information originate always",
# "set protocols ospf default-information originate metric 10",
# "set protocols ospf default-information originate route-map ingress",
# "set protocols ospf auto-cost reference-bandwidth '2'",
# "set protocols ospf parameters router-id '192.0.1.1'",
# "set protocols ospf parameters opaque-lsa",
# "set protocols ospf parameters abr-type 'cisco'",
# "set protocols ospf parameters rfc1583-compatibility",
# "set protocols ospf passive-interface eth1",
# "set protocols ospf passive-interface eth2",
# "set protocols ospf max-metric router-lsa on-shutdown 10",
# "set protocols ospf max-metric router-lsa administrative",
# "set protocols ospf max-metric router-lsa on-startup 10",
# "set protocols ospf log-adjacency-changes 'detail'",
# "set protocols ospf neighbor 192.0.11.12 priority 2",
# "set protocols ospf neighbor 192.0.11.12 poll-interval 10",
# "set protocols ospf neighbor 192.0.11.12",
# "set protocols ospf area '2'",
# "set protocols ospf area 2 authentication plaintext-password",
# "set protocols ospf area 2 shortcut enable",
# "set protocols ospf area 2 area-type normal",
# "set protocols ospf area '3'",
# "set protocols ospf area 3 area-type nssa",
# "set protocols ospf area 4 range 192.0.3.0/24 cost 10",
# "set protocols ospf area 4 range 192.0.3.0/24",
# "set protocols ospf area 4 range 192.0.4.0/24 cost 12",
# "set protocols ospf area 4 range 192.0.4.0/24",
# "set protocols ospf area 4 area-type stub default-cost 20",
# "set protocols ospf area '4'",
# "set protocols ospf area 4 network 192.0.2.0/24"
# ]
# Using parsed
#
#
- name: Parse the commands for provided structured configuration
vyos.vyos.vyos_ospfv2:
running_config:
"set protocols ospf area 2 area-type 'normal'
set protocols ospf area 2 authentication 'plaintext-password'
set protocols ospf area 2 shortcut 'enable'
set protocols ospf area 3 area-type 'nssa'
set protocols ospf area 4 area-type stub default-cost '20'
set protocols ospf area 4 network '192.0.2.0/24'
set protocols ospf area 4 range 192.0.3.0/24 cost '10'
set protocols ospf area 4 range 192.0.4.0/24 cost '12'
set protocols ospf auto-cost reference-bandwidth '2'
set protocols ospf default-information originate 'always'
set protocols ospf default-information originate metric '10'
set protocols ospf default-information originate metric-type '2'
set protocols ospf default-information originate route-map 'ingress'
set protocols ospf log-adjacency-changes 'detail'
set protocols ospf max-metric router-lsa 'administrative'
set protocols ospf max-metric router-lsa on-shutdown '10'
set protocols ospf max-metric router-lsa on-startup '10'
set protocols ospf mpls-te 'enable'
set protocols ospf mpls-te router-address '192.0.11.11'
set protocols ospf neighbor 192.0.11.12 poll-interval '10'
set protocols ospf neighbor 192.0.11.12 priority '2'
set protocols ospf parameters abr-type 'cisco'
set protocols ospf parameters 'opaque-lsa'
set protocols ospf parameters 'rfc1583-compatibility'
set protocols ospf parameters router-id '192.0.1.1'
set protocols ospf passive-interface 'eth1'
set protocols ospf passive-interface 'eth2'
set protocols ospf redistribute bgp metric '10'
set protocols ospf redistribute bgp metric-type '2'"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
# }
# Using gathered
#
# Before state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
#
- name: Gather ospfv2 routes config with provided configurations
vyos.vyos.vyos_ospfv2:
config:
state: gathered
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
# "gathered": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
#
# After state:
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
# Using deleted
#
# Before state
# -------------
#
# vyos@192# run show configuration commands | grep ospf
# set protocols ospf area 2 area-type 'normal'
# set protocols ospf area 2 authentication 'plaintext-password'
# set protocols ospf area 2 shortcut 'enable'
# set protocols ospf area 3 area-type 'nssa'
# set protocols ospf area 4 area-type stub default-cost '20'
# set protocols ospf area 4 network '192.0.2.0/24'
# set protocols ospf area 4 range 192.0.3.0/24 cost '10'
# set protocols ospf area 4 range 192.0.4.0/24 cost '12'
# set protocols ospf auto-cost reference-bandwidth '2'
# set protocols ospf default-information originate 'always'
# set protocols ospf default-information originate metric '10'
# set protocols ospf default-information originate metric-type '2'
# set protocols ospf default-information originate route-map 'ingress'
# set protocols ospf log-adjacency-changes 'detail'
# set protocols ospf max-metric router-lsa 'administrative'
# set protocols ospf max-metric router-lsa on-shutdown '10'
# set protocols ospf max-metric router-lsa on-startup '10'
# set protocols ospf mpls-te 'enable'
# set protocols ospf mpls-te router-address '192.0.11.11'
# set protocols ospf neighbor 192.0.11.12 poll-interval '10'
# set protocols ospf neighbor 192.0.11.12 priority '2'
# set protocols ospf parameters abr-type 'cisco'
# set protocols ospf parameters 'opaque-lsa'
# set protocols ospf parameters 'rfc1583-compatibility'
# set protocols ospf parameters router-id '192.0.1.1'
# set protocols ospf passive-interface 'eth1'
# set protocols ospf passive-interface 'eth2'
# set protocols ospf redistribute bgp metric '10'
# set protocols ospf redistribute bgp metric-type '2'
#
- name: Delete attributes of ospfv2 routes.
vyos.vyos.vyos_ospfv2:
config:
state: deleted
#
#
# ------------------------
# Module Execution Results
# ------------------------
#
# "before": {
# "areas": [
# {
# "area_id": "2",
# "area_type": {
# "normal": true
# },
# "authentication": "plaintext-password",
# "shortcut": "enable"
# },
# {
# "area_id": "3",
# "area_type": {
# "nssa": {
# "set": true
# }
# }
# },
# {
# "area_id": "4",
# "area_type": {
# "stub": {
# "default_cost": 20,
# "set": true
# }
# },
# "network": [
# {
# "address": "192.0.2.0/24"
# }
# ],
# "range": [
# {
# "address": "192.0.3.0/24",
# "cost": 10
# },
# {
# "address": "192.0.4.0/24",
# "cost": 12
# }
# ]
# }
# ],
# "auto_cost": {
# "reference_bandwidth": 2
# },
# "default_information": {
# "originate": {
# "always": true,
# "metric": 10,
# "metric_type": 2,
# "route_map": "ingress"
# }
# },
# "log_adjacency_changes": "detail",
# "max_metric": {
# "router_lsa": {
# "administrative": true,
# "on_shutdown": 10,
# "on_startup": 10
# }
# },
# "mpls_te": {
# "enabled": true,
# "router_address": "192.0.11.11"
# },
# "neighbor": [
# {
# "neighbor_id": "192.0.11.12",
# "poll_interval": 10,
# "priority": 2
# }
# ],
# "parameters": {
# "abr_type": "cisco",
# "opaque_lsa": true,
# "rfc1583_compatibility": true,
# "router_id": "192.0.1.1"
# },
# "passive_interface": [
# "eth2",
# "eth1"
# ],
# "redistribute": [
# {
# "metric": 10,
# "metric_type": 2,
# "route_type": "bgp"
# }
# ]
# }
# "commands": [
# "delete protocols ospf"
# ]
#
# "after": {}
# After state
# ------------
# vyos@192# run show configuration commands | grep ospf
#
返回值
常见的返回值已在此处记录,以下是此模块特有的字段
键 |
描述 |
---|---|
生成的配置模型调用。 返回:发生更改时 示例: |
|
模型调用之前的配置。 返回:始终返回 示例: |
|
推送到远程设备的命令集。 返回:始终返回 示例: |