Spec-Zone.ru › Ansible

Модуль cisco.iosxr.iosxr_lag_interfaces – модуль ресурсов для настройки интерфейсов LAG.

Примечание

Этот модуль входит в коллекцию cisco.iosxr (версия 12.3.1).

Возможно, эта коллекция уже установлена, если вы используете пакет ansible. Она не входит в ansible-core. Чтобы проверить, установлена ли она, выполните ansible-galaxy collection list.

Чтобы установить её, используйте: ansible-galaxy collection install cisco.iosxr.

Чтобы использовать её в плейбуке, укажите: cisco.iosxr.iosxr_lag_interfaces.

Добавлено в cisco.iosxr 1.0.0

  • Краткое описание
  • Параметры
  • Примечания
  • Примеры
  • Возвращаемые значения

Краткое описание

  • Этот модуль управляет атрибутами интерфейсов LAG/Ether-Bundle на устройствах IOS-XR.

Примечание

Этому модулю соответствует плагин действий.

Псевдонимы: lag_interfaces

Параметры

Параметр

Комментарии

config

list / elements=dictionary

Предоставленная конфигурация группы агрегации каналов (LAG).

links

dictionary

Этот словарь содержит настраиваемые параметры, относящиеся к каналам LAG/Ether-Bundle.

max_active

integer

Задает ограничение на количество каналов, которые могут быть активны в LAG/Ether-Bundle.

min_active

integer

Задает минимальное количество активных каналов, необходимое для включения LAG/Ether-Bundle.

Допустимые значения см. в документации производителя.

load_balancing_hash

string

Задает хеш-функцию, используемую для трафика, передаваемого через LAG/Ether-Bundle.

Параметр ‘dst-ip’ использует IP-адрес назначения в качестве хеш-функции.

Параметр ‘src-ip’ использует IP-адрес источника в качестве хеш-функции.

Варианты:

  • "dst-ip"
  • "src-ip"

members

list / elements=dictionary

Список интерфейсов-участников LAG/Ether-Bundle.

member

string

Имя интерфейса-участника.

mode

string

Задает режим работы интерфейса-участника.

Режим ‘active’ запускает LACP в активном режиме.

Режим ‘on’ отключает работу LACP на порту.

Режим ‘passive’ запускает LACP на порту в пассивном режиме.

Режим ‘inherit’ использует конфигурацию LACP, заданную для bundle.

Варианты:

  • "on"
  • "active"
  • "passive"
  • "inherit"

mode

string

Режим LAG.

Режим ‘active’ запускает LACP на порту в активном режиме.

Режим ‘on’ отключает работу LACP на порту.

Режим ‘passive’ запускает LACP на порту в пассивном режиме.

Варианты:

  • "on"
  • "active"
  • "passive"

name

string / обязательный

Имя/идентификатор настраиваемого LAG/Ether-Bundle.

running_config

string

Этот параметр используется только с состоянием parsed.

Значением этого параметра должен быть вывод, полученный с устройства IOS-XR при выполнении команды show running-config int.

Состояние parsed считывает конфигурацию из параметра running_config и преобразует её в структурированные данные Ansible согласно спецификации аргументов модуля ресурсов, после чего значение возвращается в ключе parsed результата.

state

string

Состояние конфигурации после выполнения модуля.

Варианты:

  • "merged" ← (по умолчанию)
  • "replaced"
  • "overridden"
  • "deleted"
  • "parsed"
  • "rendered"
  • "gathered"

Примечания

Примечание

  • Этот модуль работает с подключением network_cli. См. параметры платформы IOS-XR.

Примеры

# Using merged
#
#
# ------------
# Before state
# ------------
#
# RP/0/0/CPU0:iosxr01#show run int
# Sun Jul  7 19:42:59.416 UTC
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description "GigabitEthernet - 1"
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
# !
#
#
- name: Merge provided configuration with device configuration
  cisco.iosxr.iosxr_lag_interfaces:
    config:
      - name: Bundle-Ether10
        members:
          - member: GigabitEthernet0/0/0/1
            mode: inherit
          - member: GigabitEthernet0/0/0/3
            mode: inherit
        mode: active
        links:
          max_active: 5
          min_active: 2
        load_balancing_hash: src-ip
      - name: Bundle-Ether12
        members:
          - member: GigabitEthernet0/0/0/2
            mode: passive
          - member: GigabitEthernet0/0/0/4
            mode: passive
        load_balancing_hash: dst-ip
    state: merged

#
#
# -----------
# After state
# -----------
#
# RP/0/0/CPU0:iosxr01#show run int
# Sun Jul  7 20:51:17.685 UTC
# interface Bundle-Ether10
#  lacp mode active
#  bundle load-balancing hash src-ip
#  bundle maximum-active links 5
#  bundle minimum-active links 2
# !
# interface Bundle-Ether12
#  bundle load-balancing hash dst-ip
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
#   bundle id 12 mode passive
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
#  bundle id 12 mode passive
# !
#


# Using replaced
#
#
# -------------
# Before state
# -------------
#
#
# RP/0/0/CPU0:iosxr01#sho run int
# Sun Jul  7 20:58:06.527 UTC
# interface Bundle-Ether10
#  lacp mode active
#  bundle load-balancing hash src-ip
#  bundle maximum-active links 5
#  bundle minimum-active links 2
# !
# interface Bundle-Ether12
#  bundle load-balancing hash dst-ip
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
#  bundle id 12 mode passive
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
#  bundle id 12 mode passive
# !
#
#
- name: Replace device configuration of listed Bundles with provided configurations
  cisco.iosxr.iosxr_lag_interfaces:
    config:
      - name: Bundle-Ether12
        members:
          - name: GigabitEthernet0/0/0/2
        mode: passive
      - name: Bundle-Ether11
        members:
          - name: GigabitEthernet0/0/0/4
        load_balancing_hash: src-ip
    state: replaced
#
#
# -----------
# After state
# -----------
#
#
# RP/0/0/CPU0:iosxr01#sh run int
# Sun Jul  7 21:22:27.397 UTC
# interface Bundle-Ether10
#  lacp mode active
#  bundle load-balancing hash src-ip
#  bundle maximum-active links 5
#  bundle minimum-active links 2
# !
# interface Bundle-Ether11
#  bundle load-balancing hash src-ip
# !
# interface Bundle-Ether12
#  lacp mode passive
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
#  bundle id 12 mode on
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
#  bundle id 11 mode on
# !
#
#


# Using overridden
#
#
# ------------
# Before state
# ------------
#
#
# RP/0/0/CPU0:iosxr01#sh run int
# Sun Jul  7 21:22:27.397 UTC
# interface Bundle-Ether10
#  lacp mode active
#  bundle load-balancing hash src-ip
#  bundle maximum-active links 5
#  bundle minimum-active links 2
# !
# interface Bundle-Ether11
#  bundle load-balancing hash src-ip
# !
# interface Bundle-Ether12
#  lacp mode passive
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
#  bundle id 12 mode on
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
#  bundle id 11 mode on
# !
#
#

- name: Overrides all device configuration with provided configuration
  cisco.iosxr.iosxr_lag_interfaces:
    config:
      - name: Bundle-Ether10
        members:
          - member: GigabitEthernet0/0/0/1
            mode: inherit
          - member: GigabitEthernet0/0/0/2
            mode: inherit
        mode: active
        load_balancing_hash: dst-ip
    state: overridden

#
#
# ------------
# After state
# ------------
#
#
# RP/0/0/CPU0:iosxr01#sh run int
# Sun Jul  7 21:43:04.802 UTC
# interface Bundle-Ether10
#  lacp mode active
#  bundle load-balancing hash dst-ip
# !
# interface Bundle-Ether11
# !
# interface Bundle-Ether12
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
# !
#
#


# Using deleted
#
#
# ------------
# Before state
# ------------
#
# RP/0/0/CPU0:iosxr01#sh run int
# Sun Jul  7 21:22:27.397 UTC
# interface Bundle-Ether10
#  lacp mode active
#  bundle load-balancing hash src-ip
#  bundle maximum-active links 5
#  bundle minimum-active links 2
# !
# interface Bundle-Ether11
#  bundle load-balancing hash src-ip
# !
# interface Bundle-Ether12
#  lacp mode passive
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
#  bundle id 12 mode on
# !n
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
#  bundle id 11 mode on
# !
#
#

- name: >-
    Delete attributes of given bundles and removes member interfaces from them
    (Note - This won't delete the bundles themselves)
  cisco.iosxr.iosxr_lag_interfaces:
    config:
      - name: Bundle-Ether10
      - name: Bundle-Ether11
      - name: Bundle-Ether12
    state: deleted


#
#
# ------------
# After state
# ------------
#
# RP/0/0/CPU0:iosxr01#sh run int
# Sun Jul  7 21:49:50.004 UTC
# interface Bundle-Ether10
# !
# interface Bundle-Ether11
# !
# interface Bundle-Ether12
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1"
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
# !
#
#

# Using deleted (without config)
#
#
# ------------
# Before state
# ------------
#
# RP/0/0/CPU0:an-iosxr#sh run int
# Sun Aug 18 19:49:51.908 UTC
# interface Bundle-Ether10
#  lacp mode active
#  bundle load-balancing hash src-ip
#  bundle maximum-active links 10
#  bundle minimum-active links 2
# !
# interface Bundle-Ether11
#  bundle load-balancing hash dst-ip
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/0
#  shutdown
# !
# interface GigabitEthernet0/0/0/1
#  bundle id 10 mode inherit
#  shutdown
# !
# interface GigabitEthernet0/0/0/2
#  bundle id 10 mode passive
#  shutdown
# !
# interface GigabitEthernet0/0/0/3
#  bundle id 11 mode passive
#  shutdown
# !
# interface GigabitEthernet0/0/0/4
#  bundle id 11 mode passive
#  shutdown
# !
#

- name: Delete attributes of all bundles and removes member interfaces from them (Note
    - This won't delete the bundles themselves)
  cisco.iosxr.iosxr_lag_interfaces:
    state: deleted

#
#
# ------------
# After state
# ------------
#
#
# RP/0/0/CPU0:an-iosxr#sh run int
# Sun Aug 18 19:54:22.389 UTC
# interface Bundle-Ether10
# !
# interface Bundle-Ether11
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 10.8.38.69 255.255.255.0
# !
# interface GigabitEthernet0/0/0/0
#  shutdown
# !
# interface GigabitEthernet0/0/0/1
#  shutdown
# !
# interface GigabitEthernet0/0/0/2
#  shutdown
# !
# interface GigabitEthernet0/0/0/3
#  shutdown
# !
# interface GigabitEthernet0/0/0/4
#  shutdown
# !

# Using parsed:

# parsed.cfg

# interface Bundle-Ether10
#  lacp mode active
#  bundle load-balancing hash src-ip
#  bundle maximum-active links 5
#  bundle minimum-active links 2
# !
# interface Bundle-Ether12
#  bundle load-balancing hash dst-ip
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
#   bundle id 12 mode passive
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
#  bundle id 12 mode passive
# !
#
- name: Convert lag interfaces config to argspec without connecting to the appliance
  cisco.iosxr.iosxr_lag_interfaces:
    running_config: "{{ lookup('file', './parsed.cfg') }}"
    state: parsed

# --------------
# Output
# --------------
#   parsed:
#     - name: Bundle-Ether10
#       members:
#         - member: GigabitEthernet0/0/0/1
#           mode: inherit
#         - member: GigabitEthernet0/0/0/3
#           mode: inherit
#       mode: active
#       links:
#         max_active: 5
#         min_active: 2
#       load_balancing_hash: src-ip

#     - name: Bundle-Ether12
#       members:
#         - member: GigabitEthernet0/0/0/2
#           mode: passive
#         - member: GigabitEthernet0/0/0/4
#           mode: passive
#       load_balancing_hash: dst-ip

# using gathered

# Device Config:
# -------------

# interface Bundle-Ether10
#  lacp mode active
#  bundle load-balancing hash src-ip
#  bundle maximum-active links 5
#  bundle minimum-active links 2
# !
# interface Bundle-Ether12
#  bundle load-balancing hash dst-ip
# !
# interface Loopback888
#  description test for ansible
#  shutdown
# !
# interface MgmtEth0/0/CPU0/0
#  ipv4 address 192.0.2.11 255.255.255.0
# !
# interface GigabitEthernet0/0/0/1
#  description 'GigabitEthernet - 1"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/2
#  description "GigabitEthernet - 2"
#   bundle id 12 mode passive
# !
# interface GigabitEthernet0/0/0/3
#  description "GigabitEthernet - 3"
#  bundle id 10 mode inherit
# !
# interface GigabitEthernet0/0/0/4
#  description "GigabitEthernet - 4"
#  bundle id 12 mode passive
# !
#

- name: Gather IOSXR lag interfaces configuration
  cisco.iosxr.iosxr_lag_interfaces:
    config:
    state: gathered

# --------------
# Output
# --------------
#   gathered:
#     - name: Bundle-Ether10
#       members:
#         - member: GigabitEthernet0/0/0/1
#           mode: inherit
#         - member: GigabitEthernet0/0/0/3
#           mode: inherit
#       mode: active
#       links:
#         max_active: 5
#         min_active: 2
#       load_balancing_hash: src-ip

#     - name: Bundle-Ether12
#       members:
#         - member: GigabitEthernet0/0/0/2
#           mode: passive
#         - member: GigabitEthernet0/0/0/4
#           mode: passive
#       load_balancing_hash: dst-ip

# Using rendered:
- name: Render platform specific commands from task input using rendered state
  cisco.iosxr.iosxr_lag_interfaces:
    config:
      - name: Bundle-Ether10
        members:
          - member: GigabitEthernet0/0/0/1
            mode: inherit
          - member: GigabitEthernet0/0/0/3
            mode: inherit
        mode: active
        links:
          max_active: 5
          min_active: 2
        load_balancing_hash: src-ip
      - name: Bundle-Ether12
        members:
          - member: GigabitEthernet0/0/0/2
            mode: passive
          - member: GigabitEthernet0/0/0/4
            mode: passive
        load_balancing_hash: dst-ip
    state: rendered

# Output:

# rendered:
#    [
#         - "interface Bundle-Ether10"
#         - " lacp mode active"
#         - " bundle load-balancing hash src-ip"
#         - " bundle maximum-active links 5"
#         - " bundle minimum-active links 2"
#         - "interface Bundle-Ether12"
#         - " bundle load-balancing hash dst-ip"
#         - "interface Loopback888"
#         - " description test for ansible"
#         - " shutdown"
#         - "interface MgmtEth0/0/CPU0/0"
#         - " ipv4 address 192.0.2.11 255.255.255.0"
#         - "interface GigabitEthernet0/0/0/1"
#         - " description 'GigabitEthernet - 1""
#         - " bundle id 10 mode inherit"
#         - "interface GigabitEthernet0/0/0/2"
#         - " description "GigabitEthernet - 2""
#         - "  bundle id 12 mode passive"
#         - "interface GigabitEthernet0/0/0/3"
#         - " description "GigabitEthernet - 3""
#         - " bundle id 10 mode inherit"
#         - "interface GigabitEthernet0/0/0/4"
#         - " description "GigabitEthernet - 4""
#         - " bundle id 12 mode passive"
#    ]
#

Возвращаемые значения

Общие возвращаемые значения описаны здесь; ниже приведены поля, уникальные для этого модуля:

Ключ

Описание

after

list / elements=string

Конфигурация в виде структурированных данных после выполнения модуля.

Возвращается: при наличии изменений

Пример: ["The configuration returned will always be in the same format\n of the parameters above.\n"]

before

list / elements=string

Конфигурация в виде структурированных данных до вызова модуля.

Возвращается: всегда

Пример: ["The configuration returned will always be in the same format\n of the parameters above.\n"]

commands

list / elements=string

Набор команд, отправленных на удаленное устройство.

Возвращается: всегда

Пример: ["interface Bundle-Ether10", "bundle minimum-active links 2", "bundle load-balancing hash src-ip"]

Авторы

  • Nilashish Chakraborty (@NilashishC)

Ссылки на коллекцию

  • Отслеживание проблем
  • Репозиторий (исходный код)

© 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/cisco/iosxr/iosxr_lag_interfaces_module.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API