модуль arista.eos.eos_static_routes — модуль ресурса статических маршрутов
Примечание
Этот модуль входит в коллекцию arista.eos (версия 12.1.2).
Возможно, эта коллекция уже установлена, если вы используете пакет ansible. Она не входит в ansible-core. Чтобы проверить, установлена ли она, выполните ansible-galaxy collection list.
Чтобы установить её, используйте: ansible-galaxy collection install arista.eos.
Чтобы использовать её в плейбуке, укажите: arista.eos.eos_static_routes.
Добавлено в arista.eos 1.0.0
Краткое описание
- Этот модуль настраивает атрибуты статических маршрутов на платформах Arista EOS и управляет ими.
Примечание
Для этого модуля имеется соответствующий плагин действий.
Псевдонимы: static_routes
Параметры
Параметр | Комментарии |
|---|---|
config list / elements=dictionary | Список конфигураций статических маршрутов. |
|
address_families list / elements=dictionary |
Словарь, указывающий семейство адресов, к которому относятся статические маршруты. |
|
afi string / обязательный |
Указывает индикатор семейства адресов верхнего уровня. Варианты:
|
|
routes list / elements=dictionary |
Словарь, задающий конфигурации статических маршрутов. |
|
dest string / обязательный |
Подсеть IPv4 назначения (в нотации CIDR или адрес-маска). Формат адреса: <адрес v4/v6>/<маска> или <адрес v4/v6> <маска>. Для IPv4 маска должна быть числом в диапазоне 0–32, для IPv6 — в диапазоне 0–128. |
|
next_hops list / elements=dictionary |
Сведения о маршруте, который следует использовать. |
|
admin_distance integer |
Приоритет или административное расстояние маршрута (диапазон 1–255). |
|
description string |
Имя статического маршрута. |
|
forward_router_address string |
Адрес маршрутизатора пересылки на интерфейсе назначения. |
|
interface string |
Исходящий интерфейс, который следует использовать. Для всех интерфейсов, кроме «null0», также необходимо настроить IP-адрес следующего узла. IP-адрес маршрутизатора следующего узла или null0 интерфейс Null0 или ethernet e_num интерфейс Ethernet или loopback l_num интерфейс Loopback или management m_num интерфейс управления или port-channel p_num vlan v_num vxlan vx_num Nexthop-Group указать имя группы следующих узлов Tunnel туннельный интерфейс vtep настроить конечные точки туннеля VXLAN |
|
mpls_label integer |
Метка MPLS |
|
nexthop_grp string |
Группа следующих узлов |
|
tag integer |
Значение тега маршрута (в диапазоне от 0 до 4294967295). |
|
track string |
Значение отслеживания (диапазон 1–512). Перед добавлением маршрута отслеживание должно быть предварительно настроено на устройстве. |
|
vrf string |
VRF назначения. |
|
vrf string |
VRF, к которому относятся статические маршруты. |
running_config string | Этот параметр используется только при состоянии parsed. Значением этого параметра должен быть вывод, полученный с устройства EOS при выполнении команды show running-config | grep routes. При состоянии parsed конфигурация считывается из параметра |
state string | Состояние, в котором должна остаться конфигурация. Варианты:
|
Примечания
Примечание
- Проверено на Arista EOS 4.24.6F
- Этот модуль работает с подключением
network_cli. См. параметры платформы EOS.
Примеры
# Using deleted
# Before State:
# ------------
# veos(config)#show running-config | grep route
# ip route vrf testvrf 22.65.1.0/24 Null0 90 name testroute
# ipv6 route 5222:5::/64 Management1 4312:100::1
# ipv6 route vrf testvrf 2222:6::/64 Management1 4312:100::1
# ipv6 route vrf testvrf 2222:6::/64 Ethernet1 55
# ipv6 route vrf testvrf 2222:6::/64 Null0 90 name testroute1
# veos(config)#
- name: Delete afi
arista.eos.eos_static_routes:
config:
- vrf: testvrf
address_families:
- afi: ipv4
state: deleted
# Task Output
# -------------
# before:
# - address_families:
# - afi: ipv6
# routes:
# - dest: 5222:5::/64
# next_hops:
# - forward_router_address: 4312:100::1
# interface: Management1
# - address_families:
# - afi: ipv4
# routes:
# - dest: 22.65.1.0/24
# next_hops:
# - admin_distance: 90
# description: testroute
# interface: Null0
# - afi: ipv6
# routes:
# - dest: 2222:6::/64
# next_hops:
# - forward_router_address: 4312:100::1
# interface: Management1
# - admin_distance: 55
# interface: Ethernet1
# - admin_distance: 90
# description: testroute1
# interface: Null0
# vrf: testvrf
# commands:
# - no ip route vrf testvrf 22.65.1.0/24 Null0 90 name testroute
# after:
# - address_families:
# - afi: ipv6
# routes:
# - dest: 5222:5::/64
# next_hops:
# - forward_router_address: 4312:100::1
# interface: Management1
# - address_families:
# - afi: ipv6
# routes:
# - dest: 2222:6::/64
# next_hops:
# - forward_router_address: 4312:100::1
# interface: Management1
# - admin_distance: 55
# interface: Ethernet1
# - admin_distance: 90
# description: testroute1
# interface: Null0
# vrf: testvrf
# After State
# ___________
# veos(config)#show running-config | grep route
# ipv6 route 5222:5::/64 Management1 4312:100::1
# ipv6 route vrf testvrf 2222:6::/64 Management1 4312:100::1
# ipv6 route vrf testvrf 2222:6::/64 Ethernet1 55
# ipv6 route vrf testvrf 2222:6::/64 Null0 90 name testroute1
# Using merged
# Before State
# -------------
# veos(config)#show running-config | grep "route"
# ip route 165.10.1.0/24 Ethernet1 100
# ip route 172.17.252.0/24 Nexthop-Group testgroup
# ip route vrf testvrf 130.1.122.0/24 Ethernet1 tag 50
# ipv6 route 5001::/64 Ethernet1 50
# veos(config)#
- name: Merge new static route configuration
arista.eos.eos_static_routes:
config:
- vrf: testvrf
address_families:
- afi: ipv6
routes:
- dest: 2211::0/64
next_hop:
- forward_router_address: 100:1::2
interface: Ethernet1
state: merged
# Task Output
# -------------
# before:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 165.10.1.0/24
# next_hops:
# - admin_distance: 100
# interface: Ethernet1
# - dest: 172.17.252.0/24
# next_hops:
# - nexthop_grp: testgroup
# - afi: ipv6
# routes:
# - dest: 5001::/64
# next_hops:
# - admin_distance: 50
# interface: Ethernet1
# - address_families:
# - afi: ipv4
# routes:
# - dest: 130.1.122.0/24
# next_hops:
# - interface: Ethernet1
# tag: 50
# vrf: testvrf
# commands:
# - ipv6 route 2211::/64 Ethernet1 100:1::2
# after:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 165.10.1.0/24
# next_hops:
# - admin_distance: 100
# interface: Ethernet1
# - dest: 172.17.252.0/24
# next_hops:
# - nexthop_grp: testgroup
# - afi: ipv6
# routes:
# - dest: 5001::/64
# next_hops:
# - admin_distance: 50
# interface: Ethernet1
# - address_families:
# - afi: ipv4
# routes:
# - dest: 130.1.122.0/24
# next_hops:
# - interface: Ethernet1
# tag: 50
# - afi: ipv6
# routes:
# - dest: 2211::0/64
# next_hops:
# - aforward_router_address: "100:1::2"
# interface: Ethernet1
# vrf: testvrf
# After State
# -----------
# veos(config)#show running-config | grep "route"
# ip route 165.10.1.0/24 Ethernet1 100
# ip route 172.17.252.0/24 Nexthop-Group testgroup
# ip route vrf testvrf 130.1.122.0/24 Ethernet1 tag 50
# ipv6 route 2211::/64 Ethernet1 100:1::2
# ipv6 route 5001::/64 Ethernet1 50
# veos(config)#
# Using overridden
# Before State
# -------------
# veos(config)#show running-config | grep "route"
# ip route 165.10.1.0/24 Ethernet1 100
# ip route 172.17.252.0/24 Nexthop-Group testgroup
# ip route vrf testvrf 130.1.122.0/24 Ethernet1 tag 50
# ipv6 route 5001::/64 Ethernet1 50
# veos(config)#
- name: Overridden static route configuration
arista.eos.eos_static_routes:
config:
- address_families:
- afi: ipv4
routes:
- dest: 10.2.2.0/24
next_hop:
- interface: Ethernet1
state: replaced
# Task Output
# -------------
# before:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 165.10.1.0/24
# next_hops:
# - admin_distance: 100
# interface: Ethernet1
# - dest: 172.17.252.0/24
# next_hops:
# - nexthop_grp: testgroup
# - afi: ipv6
# routes:
# - dest: 5001::/64
# next_hops:
# - admin_distance: 50
# interface: Ethernet1
# - address_families:
# - afi: ipv4
# routes:
# - dest: 130.1.122.0/24
# next_hops:
# - interface: Ethernet1
# tag: 50
# vrf: testvrf
# commands:
# - no ip route 165.10.1.0/24 Ethernet1 100
# - no ip route 172.17.252.0/24 Nexthop-Group testgroup
# - no ip route vrf testvrf 130.1.122.0/24 Ethernet1 tag 50
# - no ipv6 route 5001::/64 Ethernet1 50
# - ip route 10.2.2.0/24 Ethernet1
# after:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 10.2.2.0/24
# next_hops:
# - interface: Ethernet1
# After State
# -----------
# veos(config)#show running-config | grep "route"
# ip route 10.2.2.0/24 Ethernet1
# veos(config)#
# Using replaced
# Before State
# -------------
# ip route 10.2.2.0/24 Ethernet1
# ip route 10.2.2.0/24 64.1.1.1 label 17 33
# ip route 33.33.33.0/24 Nexthop-Group testgrp
# ip route vrf testvrf 22.65.1.0/24 Null0 90 name testroute
# ipv6 route 5222:5::/64 Management1 4312:100::1
# ipv6 route vrf testvrf 2222:6::/64 Management1 4312:100::1
# ipv6 route vrf testvrf 2222:6::/64 Ethernet1 55
# ipv6 route vrf testvrf 2222:6::/64 Null0 90 name testroute1
- name: Replace nexthop
arista.eos.eos_static_routes:
config:
- vrf: testvrf
address_families:
- afi: ipv6
routes:
- dest: 2222:6::/64
next_hops:
- admin_distance: 56
interface: Ethernet1
state: replaced
# Task Output
# -------------
# before:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 10.2.2.0/24
# next_hops:
# - interface: Ethernet1
# - admin_distance: 33
# interface: 64.1.1.1
# mpls_label: 17
# - dest: 33.33.33.0/24
# next_hops:
# - nexthop_grp: testgrp
# - afi: ipv6
# routes:
# - dest: 5222:5::/64
# next_hops:
# - forward_router_address: 4312:100::1
# interface: Management1
# - address_families:
# - afi: ipv4
# routes:
# - dest: 22.65.1.0/24
# next_hops:
# - admin_distance: 90
# description: testroute
# interface: Null0
# - afi: ipv6
# routes:
# - dest: 2222:6::/64
# next_hops:
# - forward_router_address: 4312:100::1
# interface: Management1
# - admin_distance: 90
# description: testroute1
# interface: Null0
# vrf: testvrf
# commands:
# - no ipv6 route vrf testvrf 2222:6::/64 Management1 4312:100::1
# - no ipv6 route vrf testvrf 2222:6::/64 Ethernet1 55
# - no ipv6 route vrf testvrf 2222:6::/64 Null0 90 name testroute1
# - ipv6 route vrf testvrf 2222:6::/64 Ethernet1 56
# after:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 10.2.2.0/24
# next_hops:
# - interface: Ethernet1
# - admin_distance: 33
# interface: 64.1.1.1
# mpls_label: 17
# - dest: 33.33.33.0/24
# next_hops:
# - nexthop_grp: testgrp
# - afi: ipv6
# routes:
# - dest: 5222:5::/64
# next_hops:
# - forward_router_address: 4312:100::1
# interface: Management1
# - address_families:
# - afi: ipv4
# routes:
# - dest: 22.65.1.0/24
# next_hops:
# - admin_distance: 90
# description: testroute
# interface: Null0
# - afi: ipv6
# routes:
# - dest: 2222:6::/64
# next_hops:
# - admin_distance: 56
# interface: Ethernet1
# vrf: testvrf
# After State
# -----------
# veos(config)#show running-config | grep route
# ip route 10.2.2.0/24 Ethernet1
# ip route 10.2.2.0/24 64.1.1.1 label 17 33
# ip route 33.33.33.0/24 Nexthop-Group testgrp
# ip route vrf testvrf 22.65.1.0/24 Null0 90 name testroute
# ipv6 route 5222:5::/64 Management1 4312:100::1
# ipv6 route vrf testvrf 2222:6::/64 Ethernet1 55
# Using Gathered
# Before State
# -------------
# veos(config)#show running-config | grep "route"
# ip route 165.10.1.0/24 Ethernet1 10.1.1.2 100
# ipv6 route 5001::/64 Ethernet1
# veos(config)#
- name: Gather the exisitng condiguration
arista.eos.eos_static_routes:
state: gathered
# Task Output
# -------------
# gathered:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 165.10.1.0/24
# next_hop:
# - forward_router_address: 10.1.1.2
# interface: Ethernet1
# admin_distance: 100
# - afi: ipv6
# routes:
# - dest: 5001::/64
# next_hop:
# - interface: Ethernet1
# Using rendered
# arista.eos.eos_static_routes:
# config:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 165.10.1.0/24
# next_hop:
# - forward_router_address: 10.1.1.2
# interface: "Ethernet1"
# admin_distance: 100
# - afi: ipv6
# routes:
# - dest: 5001::/64
# next_hop:
# - interface: "Ethernet1"
# Task Output
# -------------
# rendered:
# - ip route 165.10.1.0/24 Ethernet1 10.1.1.2 100
# - ipv6 route 5001::/64 Ethernet1
# Using parsed:
# parse_static_routes.cfg
# ip route 165.10.1.0/24 Ethernet1 10.1.1.2 100
# ipv6 route 5001::/64 Ethernet1
#
- name: parse configs
arista.eos.eos_static_routes:
running_config: "{{ lookup('file', './parse_static_routes.cfg') }}"
state: parsed
# Task Output
# -------------
# parsed:
# - address_families:
# - afi: ipv4
# routes:
# - dest: 165.10.1.0/24
# next_hop:
# - forward_router_address: 10.1.1.2
# interface: Ethernet1
# admin_distance: 100
# - afi: ipv6
# routes:
# - dest: 5001::/64
# next_hop:
# - interface: Ethernet1
Возвращаемые значения
Общие возвращаемые значения описаны здесь; ниже перечислены поля, уникальные для этого модуля:
Ключ | Описание |
|---|---|
after list / elements=string | Итоговая конфигурация после вызова модели. Возвращается: при изменении Пример: |
before list / elements=string | Конфигурация до вызова модели. Возвращается: всегда Пример: |
commands list / elements=string | Набор команд, отправленных на удалённое устройство. Возвращается: всегда Пример: |
gathered list / elements=string | Конфигурация в виде структурированных данных, преобразованных из текущей конфигурации, полученной с удалённого узла Возвращается: когда Пример: |
parsed list / elements=string | Конфигурация в виде структурированных данных, преобразованных из значения параметра Возвращается: когда Пример: |
rendered list / elements=string | Набор команд CLI, сформированных на основе значения параметра Возвращается: когда Пример: |
Ссылки на коллекцию
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/arista/eos/eos_static_routes_module.html