junipernetworks.junos.junos_routing_options 模块 – 管理 Junos 设备上的路由选项配置。
注意
此模块是 junipernetworks.junos 集合 (版本 9.1.0) 的一部分。
如果您使用的是 ansible
包,则可能已安装此集合。它不包含在 ansible-core
中。要检查是否已安装它,请运行 ansible-galaxy collection list
。
要安装它,请使用: ansible-galaxy collection install junipernetworks.junos
。您需要其他要求才能使用此模块,有关详细信息,请参阅 要求。
要在 playbook 中使用它,请指定: junipernetworks.junos.junos_routing_options
。
junipernetworks.junos 2.8.0 中的新增功能
概要
此模块管理运行 Junos 的设备上的路由选项配置。
要求
执行此模块的主机需要以下要求。
ncclient (>=v0.6.4)
xmltodict (>=0.12.0)
参数
参数 |
注释 |
---|---|
路由选项配置的字典。 |
|
指定自治系统编号。 |
|
指定自治系统编号。 |
|
启用 AS 点表示法以显示真实的 4 字节 AS 号码。 选项
|
|
指定此 AS 在 AS 路径中出现的最大次数。 |
|
指定路由器标识符。 |
|
此选项仅与状态 *parsed* 一起使用。 此选项的值应为通过执行命令 **show system routing-options** 从 Junos 设备接收到的输出。 状态 *parsed* 从 |
|
配置应保留的状态。 有关更多详细信息,请参阅示例。 选项
|
注释
注意
此模块要求在被管理的设备上启用 netconf 系统服务。
此模块与连接
netconf
一起使用。请参阅 Junos OS 平台选项。
针对 JunOS v18.4R1 进行了测试
示例
# Using merged
#
# Before state
# ------------
#
# vagrant@vsrx# show system routing-options
#
- name: Merge provided NTP configuration into running configuration.
junipernetworks.junos.junos_routing_options:
config:
autonomous_system:
as_number: 2
asdot_notation: true
state: merged
#
# -------------------------
# Module Execution Result
# -------------------------
# "after": {
# "autonomous_system": {
# "as_number": "2",
# "asdot_notation": true
# }
# },
# "before": {},
# "changed": true,
# "commands": [
# "<nc:routing-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">"
# "<nc:autonomous-system>2<nc:asdot-notation/></nc:autonomous-system></nc:routing-options>"
# ]
# After state
# -----------
#
# vagrant@vsrx# show routing-options
# autonomous-system 2 asdot-notation;
#
#
# Using Replaced
# Before state
# ------------
#
# vagrant@vsrx# show routing-options
# autonomous-system 2 asdot-notation;
- name: Replaced running routing-options configuration with provided configuration
junipernetworks.junos.junos_routing_options:
config:
autonomous_system:
as_number: 2
asdot_notation: true
router_id: "1.1.1.1"
state: replaced
#
# -------------------------
# Module Execution Result
# -------------------------
# "after": {
# "autonomous_system": {
# "as_number": "2",
# "asdot_notation": true
# },
# "router_id": "1.1.1.1"
# },
# "before": {
# "autonomous_system": {
# "as_number": "2",
# "asdot_notation": true
# }
# },
# "changed": true,
# "commands": [
# "<nc:routing-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">"
# "<nc:autonomous-system delete="delete"/><nc:autonomous-system>2<nc:asdot-notation/>"
# "</nc:autonomous-system><nc:router-id>1.1.1.1</nc:router-id></nc:routing-options>"
# ]
# After state
# -----------
#
# vagrant@vsrx# show routing-options
# router-id 1.1.1.1;
# autonomous-system 2 asdot-notation;
# Using overridden
#
# vagrant@vsrx# show routing-options
# autonomous-system 2 asdot-notation;
- name: Override running routing-options configuration with provided configuration
junipernetworks.junos.junos_routing_options:
config:
autonomous_system:
as_number: 2
asdot_notation: true
router_id: "1.1.1.1"
state: overridden
#
# -------------------------
# Module Execution Result
# -------------------------
# "after": {
# "autonomous_system": {
# "as_number": "2",
# "asdot_notation": true
# },
# "router_id": "1.1.1.1"
# },
# "before": {
# "autonomous_system": {
# "as_number": "2",
# "asdot_notation": true
# }
# },
# "changed": true,
# "commands": [
# "<nc:routing-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">"
# "<nc:autonomous-system delete="delete"/><nc:autonomous-system>2<nc:asdot-notation/>"
# "</nc:autonomous-system><nc:router-id>1.1.1.1</nc:router-id></nc:routing-options>"
# ]
# After state
# -----------
#
# vagrant@vsrx# show routing-options
# router-id 1.1.1.1;
# autonomous-system 2 asdot-notation;
#
# Using deleted
#
# Before state
# ------------
#
# vagrant@vsrx# show routing-options
# router-id 1.1.1.1;
# autonomous-system 2 asdot-notation;
#
- name: Delete running routing-options configuration
junipernetworks.junos.junos_routing_options:
config:
state: deleted
#
# -------------------------
# Module Execution Result
# -------------------------
# "after": {},
# "before": {
# "autonomous_system": {
# "as_number": "2",
# "asdot_notation": true
# },
# "router_id": "1.1.1.1"
# },
# "changed": true,
# "commands": [
# "<nc:routing-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">"
# "<nc:autonomous-system delete="delete"/><nc:router-id delete="delete"/></nc:routing-options>"
# ]
# After state
# -----------
#
# vagrant@vsrx# show routing-options
#
# [edit]
# Using gathered
#
# Before state
# ------------
#
# vagrant@vsrx# show routing-options
# router-id 1.1.1.1;
# autonomous-system 2 asdot-notation;
- name: Gather running routing-options configuration
junipernetworks.junos.junos_routing_options:
state: gathered
#
# -------------------------
# Module Execution Result
# -------------------------
# "gathered": {
# "autonomous_system": {
# "as_number": "2",
# "asdot_notation": true
# },
# "router_id": "1.1.1.1"
# },
# "changed": false,
# Using rendered
#
# Before state
# ------------
#
- name: Render xml for provided facts.
junipernetworks.junos.junos_routing_options:
config:
autonomous_system:
as_number: 2
asdot_notation: true
loops: 4
router_id: 12.12.12.12
state: rendered
#
# -------------------------
# Module Execution Result
# -------------------------
# "rendered": [
# "<nc:routing-options xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
# "<nc:autonomous-system>2<nc:loops>4</nc:loops><nc:asdot-notation/></nc:autonomous-system>
# "<nc:router-id>12.12.12.12</nc:router-id></nc:routing-options>"
# ]
#
# Using parsed
# parsed.cfg
# ------------
# <?xml version="1.0" encoding="UTF-8"?>
# <rpc-reply message-id="urn:uuid:0cadb4e8-5bba-47f4-986e-72906227007f">
# <configuration changed-seconds="1590139550" changed-localtime="2020-05-22 09:25:50 UTC">
# <version>18.4R1-S2.4</version>
# <routing-options>
# <router-id>12.12.12.12</router-id>
# <autonomous-system>
# <as-number>2</as-number>
# <loops>4</loops>
# <asdot-notation/>
# </autonomous-system>
# </routing-options>
# </configuration>
# </rpc-reply>
#
- name: Parse routing-options running config
junipernetworks.junos.junos_routing_options:
running_config: "{{ lookup('file', './parsed.cfg') }}"
state: parsed
#
#
# -------------------------
# Module Execution Result
# -------------------------
#
#
# "parsed": {
# "autonomous_system": {
# "as_number": "2",
# "asdot_notation": true,
# "loops": 4
# },
# "router_id": "12.12.12.12"
# }
#
返回值
此处记录了常见的返回值 此处,以下是此模块独有的字段
键 |
描述 |
---|---|
生成的配置模型调用。 返回:已更改时 示例: |
|
模型调用之前的配置。 返回:始终 示例: |
|
推送到远程设备的命令集。 返回:始终 示例: |