Spec-Zone.ru › Ansible 2.11

cisco.ios.ios_lacp_interfaces – Модуль ресурсов интерфейсов LACP

Примечание

Этот плагин входит в коллекцию cisco.ios (версия 1.3.0).

Для его установки используйте: ansible-galaxy collection install cisco.ios.

Для использования в плейбуке укажите: cisco.ios.ios_lacp_interfaces.

Новое в версии 1.0.0: модуля cisco.ios

  • Обзор
  • Параметры
  • Примечания
  • Примеры
  • Возвращаемые значения

Обзор

  • Этот модуль предоставляет декларативное управление LACP на сетевых устройствах Cisco IOS для интерфейсов lacp_interfaces.

Примечание

У этого модуля есть соответствующий плагин действий.

Параметры

Параметр Варианты/Значения по умолчанию Комментарии
config
список / элементы=словарь
Словарь опций LACP lacp_interfaces
fast_switchover
логический
    Варианты:
  • no
  • yes
Поддержка быстрого переключения LACP на этом канале портов.
max_bundle
целое число
Максимальное количество портов для объединения в этом канале портов LACP.
См. документацию производителя для допустимых значений портов.
name
строка / обязательно
Имя интерфейса для настройки LACP.
port_priority
целое число
Приоритет LACP на этом интерфейсе.
См. документацию производителя для допустимых значений портов.
running_config
строка
Эта опция используется только со состоянием parsed.
Значение этой опции должно быть результатом выполнения команды show running-config | section ^interface на устройстве IOS.
Состояние parsed считывает конфигурацию из опции running_config, преобразует её в структурированные данные Ansible, соответствующие спецификации модуля ресурсов, и возвращает значение в ключе parsed в результате.
state
строка
    Варианты:
  • merged ←
  • replaced
  • overridden
  • deleted
  • rendered
  • gathered
  • parsed
Состояние, в котором должна остаться конфигурация
Состояния rendered, gathered и parsed не вносят изменений на устройство.
Состояние rendered преобразует конфигурацию в опции config, в команды CLI, специфичные для платформы, которые будут возвращены в ключе rendered в результате. Для состояния rendered активное подключение к удалённому хосту не требуется.
Состояние gathered извлекает текущую конфигурацию с устройства и преобразует её в структурированные данные в формате, соответствующем спецификации модуля ресурсов, и возвращает значение в ключе gathered в результате.
Состояние parsed считывает конфигурацию из опции running_config, преобразует её в формат JSON, соответствующий параметрам модуля ресурсов, и возвращает значение в ключе parsed в результате. Значение опции running_config должно быть в том же формате, что и вывод команды show running-config | include ip route|ipv6 route, выполненной на устройстве. Для состояния parsed активное подключение к удалённому хосту не требуется.

Примечания

Примечание

  • Тестировалось на Cisco IOSv версии 15.2 на VIRL.

Примеры

# Using merged
#
# Before state:
# -------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
#  shutdown
# interface GigabitEthernet0/2
#  shutdown
# interface GigabitEthernet0/3
#  shutdown

- name: Merge provided configuration with device configuration
  cisco.ios.ios_lacp_interfaces:
    config:
    - name: GigabitEthernet0/1
      port_priority: 10
    - name: GigabitEthernet0/2
      port_priority: 20
    - name: GigabitEthernet0/3
      port_priority: 30
    - name: Port-channel10
      fast_switchover: true
      max_bundle: 5
    state: merged

# After state:
# ------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
#  lacp fast-switchover
#  lacp max-bundle 5
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
#  shutdown
#  lacp port-priority 10
# interface GigabitEthernet0/2
#  shutdown
#  lacp port-priority 20
# interface GigabitEthernet0/3
#  shutdown
#  lacp port-priority 30

# Using overridden
#
# Before state:
# -------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
#  lacp fast-switchover
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
#  shutdown
#  lacp port-priority 10
# interface GigabitEthernet0/2
#  shutdown
#  lacp port-priority 20
# interface GigabitEthernet0/3
#  shutdown
#  lacp port-priority 30

- name: Override device configuration of all lacp_interfaces with provided configuration
  cisco.ios.ios_lacp_interfaces:
    config:
    - name: GigabitEthernet0/1
      port_priority: 20
    - name: Port-channel10
      max_bundle: 2
    state: overridden

# After state:
# ------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
#  lacp max-bundle 2
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
#  shutdown
#  lacp port-priority 20
# interface GigabitEthernet0/2
#  shutdown
# interface GigabitEthernet0/3
#  shutdown

# Using replaced
#
# Before state:
# -------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
#  lacp max-bundle 5
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
#  shutdown
#  lacp port-priority 10
# interface GigabitEthernet0/2
#  shutdown
#  lacp port-priority 20
# interface GigabitEthernet0/3
#  shutdown
#  lacp port-priority 30

- name: Replaces device configuration of listed lacp_interfaces with provided configuration
  cisco.ios.ios_lacp_interfaces:
    config:
    - name: GigabitEthernet0/3
      port_priority: 40
    - name: Port-channel10
      fast_switchover: true
      max_bundle: 2
    state: replaced

# After state:
# ------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
#  lacp fast-switchover
#  lacp max-bundle 2
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
#  shutdown
#  lacp port-priority 10
# interface GigabitEthernet0/2
#  shutdown
#  lacp port-priority 20
# interface GigabitEthernet0/3
#  shutdown
#  lacp port-priority 40

# Using Deleted
#
# Before state:
# -------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
#  flowcontrol receive on
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
#  shutdown
#  lacp port-priority 10
# interface GigabitEthernet0/2
#  shutdown
#  lacp port-priority 20
# interface GigabitEthernet0/3
#  shutdown
#  lacp port-priority 30

- name: "Delete LACP attributes of given interfaces (Note: This won't delete the interface itself)"
  cisco.ios.ios_lacp_interfaces:
    config:
    - name: GigabitEthernet0/1
    state: deleted

# After state:
# -------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
#  shutdown
# interface GigabitEthernet0/2
#  shutdown
#  lacp port-priority 20
# interface GigabitEthernet0/3
#  shutdown
#  lacp port-priority 30

# Using Deleted without any config passed
# "(NOTE: This will delete all of configured LLDP module attributes)"
#
# Before state:
# -------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
#  lacp fast-switchover
# interface Port-channel20
#  lacp max-bundle 2
# interface Port-channel30
# interface GigabitEthernet0/1
#  shutdown
#  lacp port-priority 10
# interface GigabitEthernet0/2
#  shutdown
#  lacp port-priority 20
# interface GigabitEthernet0/3
#  shutdown
#  lacp port-priority 30

- name: "Delete LACP attributes for all configured interfaces (Note: This won't delete the interface itself)"
  cisco.ios.ios_lacp_interfaces:
    state: deleted

# After state:
# -------------
#
# vios#show running-config | section ^interface
# interface Port-channel10
# interface Port-channel20
# interface Port-channel30
# interface GigabitEthernet0/1
#  shutdown
# interface GigabitEthernet0/2
#  shutdown
# interface GigabitEthernet0/3
#  shutdown

# Using Gathered

# Before state:
# -------------
#
# vios#sh running-config | section ^interface
# interface Port-channel10
#  lacp fast-switchover
#  lacp max-bundle 2
# interface Port-channel40
#  lacp max-bundle 5
# interface GigabitEthernet0/0
# interface GigabitEthernet0/1
#  lacp port-priority 30
# interface GigabitEthernet0/2
#  lacp port-priority 20

- name: Gather listed LACP interfaces with provided configurations
  cisco.ios.ios_lacp_interfaces:
    config:
    state: gathered

# Module Execution Result:
# ------------------------
#
# "gathered": [
#         {
#             "fast_switchover": true,
#             "max_bundle": 2,
#             "name": "Port-channel10"
#         },
#         {
#             "max_bundle": 5,
#             "name": "Port-channel40"
#         },
#         {
#             "name": "GigabitEthernet0/0"
#         },
#         {
#             "name": "GigabitEthernet0/1",
#             "port_priority": 30
#         },
#         {
#             "name": "GigabitEthernet0/2",
#             "port_priority": 20
#         }
#     ]

# After state:
# ------------
#
# vios#sh running-config | section ^interface
# interface Port-channel10
#  lacp fast-switchover
#  lacp max-bundle 2
# interface Port-channel40
#  lacp max-bundle 5
# interface GigabitEthernet0/0
# interface GigabitEthernet0/1
#  lacp port-priority 30
# interface GigabitEthernet0/2
#  lacp port-priority 20

# Using Rendered

- name: Render the commands for provided  configuration
  cisco.ios.ios_lacp_interfaces:
    config:
    - name: GigabitEthernet0/1
      port_priority: 10
    - name: GigabitEthernet0/2
      port_priority: 20
    - name: Port-channel10
      fast_switchover: true
      max_bundle: 2
    state: rendered

# Module Execution Result:
# ------------------------
#
# "rendered": [
#         "interface GigabitEthernet0/1",
#         "lacp port-priority 10",
#         "interface GigabitEthernet0/2",
#         "lacp port-priority 20",
#         "interface Port-channel10",
#         "lacp max-bundle 2",
#         "lacp fast-switchover"
#     ]

# Using Parsed

# File: parsed.cfg
# ----------------
#
# interface GigabitEthernet0/1
# lacp port-priority 10
# interface GigabitEthernet0/2
# lacp port-priority 20
# interface Port-channel10
# lacp max-bundle 2 fast-switchover

- name: Parse the commands for provided configuration
  cisco.ios.ios_lacp_interfaces:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed

# Module Execution Result:
# ------------------------
#
# "parsed": [
#         {
#             "name": "GigabitEthernet0/1",
#             "port_priority": 10
#         },
#         {
#             "name": "GigabitEthernet0/2",
#             "port_priority": 20
#         },
#         {
#             "fast_switchover": true,
#             "max_bundle": 2,
#             "name": "Port-channel10"
#         }
#     ]

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

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

Ключ Возвращаемое значение Описание
after
список / элементы=строка
при изменении
Конфигурация в виде структурированных данных после выполнения модуля.

Пример:
Возвращаемая конфигурация всегда будет в том же формате, что и вышеупомянутые параметры.
before
список / элементы=строка
всегда
Конфигурация в виде структурированных данных до вызова модуля.

Пример:
Возвращаемая конфигурация всегда будет в том же формате, что и вышеупомянутые параметры.
commands
список / элементы=строка
всегда
Набор команд, отправленных на удалённое устройство.

Пример:
['interface GigabitEthernet 0/1', 'lacp port-priority 30']


Авторы

  • Sumit Jaiswal (@justjais)

© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/cisco/ios/ios_lacp_interfaces_module.html

Spec-Zone.ru

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