Spec-Zone.ru › Ansible

Модуль junipernetworks.junos.junos_lag_interfaces — Ресурсный модуль агрегации каналов Juniper JUNOS

Примечание

Этот модуль является частью коллекции junipernetworks.junos (версия 8.0.0).

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

Для установки используйте: ansible-galaxy collection install junipernetworks.junos. Для использования этого модуля необходимы дополнительные требования, см. Требования для получения подробной информации.

Для использования в плейбуке укажите: junipernetworks.junos.junos_lag_interfaces.

Новое в junipernetworks.junos 1.0.0

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

Обзор

  • Этот модуль управляет свойствами группы агрегации каналов на устройствах Juniper JUNOS.

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

Требования

Ниже перечислены требования, необходимые на хосте, на котором выполняется этот модуль.

  • ncclient (>=v0.6.4)

Параметры

Параметр

Комментарии

config

список / элементы=словарь

Список конфигураций групп агрегации каналов.

link_protection

логическое

Этот логический параметр указывает, следует ли включить защиту канала для интерфейса LAG. Если значение равно True, защита канала включена в LAG, а если значение равно False, защита канала отключена.

Варианты:

  • false
  • true

members

список / элементы=словарь

Список интерфейсов-членов группы агрегации каналов. Значение может быть отдельным интерфейсом или списком интерфейсов.

link_type

строка

Это значение параметра настраивает интерфейс-член как primary или backup. Значение primary настраивает первичный интерфейс для режима защиты канала, а backup настраивает резервный интерфейс для режима защиты канала.

Варианты:

  • "primary"
  • "backup"

member

строка

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

mode

строка

Режим LAG. Значение passive включит LACP в режиме passive, то есть он будет реагировать на пакеты LACP, а active настроит интерфейс на инициирование передачи пакетов LACP.

Варианты:

  • "active"
  • "passive"

name

строка / обязательно

Имя группы агрегации каналов (LAG).

running_config

строка

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

Значение этого параметра должно быть результатом выполнения команды show interfaces на устройстве Junos.

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

state

строка

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

Варианты:

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

Примечания

Примечание

  • Для работы этого модуля требуется включенная на управляемом удалённом устройстве служба netconf.
  • Тестировано на vSRX JUNOS версии 18.4R1.
  • Этот модуль работает с типом соединения netconf. См. параметры платформы Junos OS.

Примеры

# Using merged

# Before state:
# -------------
# user@junos01# show interfaces
# ge-0/0/1 {
#    description "Ansible configured interface 1";
#    ether-options {
#        802.3ad ae0;
#    }
# }
# ge-0/0/2 {
#    description "Ansible configured interface 2";
#    ether-options {
#        802.3ad ae0;
#    }
# }
# ae0 {
#     description "lag interface";
# }
# ae1 {
#     description "lag interface 1";
# }

- name: "Delete LAG attributes of given interfaces (Note: This won't delete the interface itself)"
  junipernetworks.junos.junos_lag_interfaces:
    config:
      - name: ae0
      - name: ae1
    state: deleted

# After state:
# -------------
# user@junos01# show interfaces
# ge-0/0/1 {
#    description "Ansible configured interface 1";
# }
# ge-0/0/2 {
#    description "Ansible configured interface 2";
# }


# Using merged

# Before state:
# -------------
# user@junos01# show interfaces
# ge-0/0/1 {
#    description "Ansible configured interface 1";
# }
# ge-0/0/2 {
#    description "Ansible configured interface 2";
# }

- name: Merge provided configuration with device configuration
  junipernetworks.junos.junos_lag_interfaces:
    config:
      - name: ae0
        members:
          - member: ge-0/0/1
            link_type: primary
          - member: ge-0/0/2
            link_type: backup
    state: merged

# After state:
# -------------
# user@junos01# show interfaces
# ge-0/0/1 {
#    description "Ansible configured interface 1";
#    ether-options {
#        802.3ad {
#            ae0;
#            primary;
#        }
#    }
# }
# ge-0/0/2 {
#    description "Ansible configured interface 2";
#    ether-options {
#        802.3ad {
#            ae0;
#            backup;
#        }
#    }
# }


# Using merged

# Before state:
# -------------
# user@junos01# show interfaces
# ge-0/0/1 {
#    description "Ansible configured interface 1";
#    ether-options {
#        802.3ad ae0;
#    }
# }
# ge-0/0/2 {
#    description "Ansible configured interface 2";
#    ether-options {
#        802.3ad ae0;
#    }
# }
# ae0 {
#     description "lag interface";
# }
# ae3 {
#     description "lag interface 3";
# }

- name: Overrides all device LAG configuration with provided configuration
  junipernetworks.junos.junos_lag_interfaces:
    config:
      - name: ae0
        members:
          - member: ge-0/0/2
      - name: ae1
        members:
          - member: ge-0/0/1
        mode: passive
    state: overridden

# After state:
# -------------
# user@junos01# show interfaces
# ge-0/0/1 {
#    description "Ansible configured interface 1";
#    ether-options {
#        802.3ad ae1;
#    }
# }
# ge-0/0/2 {
#    description "Ansible configured interface 2";
#    ether-options {
#        802.3ad ae0;
#    }
# }
# ae0 {
#     description "lag interface";
# }
# ae1 {
#    aggregated-ether-options {
#        lacp {
#            active;
#        }
#    }
# }


# Using merged

# Before state:
# -------------
# user@junos01# show interfaces
# ge-0/0/1 {
#    description "Ansible configured interface 1";
# }
# ge-0/0/2 {
#    description "Ansible configured interface 2";
# }
# ge-0/0/3 {
#    description "Ansible configured interface 3";
# }

- name: Replace device LAG configuration with provided configuration
  junipernetworks.junos.junos_lag_interfaces:
    config:
      - name: ae0
        members:
          - member: ge-0/0/1
        mode: active
    state: replaced

# After state:
# -------------
# user@junos01# show interfaces
# ge-0/0/1 {
#    description "Ansible configured interface 1";
#    ether-options {
#        802.3ad ae0;
#    }
# }
# ge-0/0/2 {
#    description "Ansible configured interface 2";
# }
# ae0 {
#    aggregated-ether-options {
#        lacp {
#            active;
#        }
#    }
# }
# ge-0/0/3 {
#    description "Ansible configured interface 3";
# }
# Using gathered
# Before state:
# ------------
#
# ansible@cm123456tr21# show interfaces
# ge-0/0/1 {
#     ether-options {
#         802.3ad ae1;
#     }
# }
# ge-0/0/2 {
#     ether-options {
#         802.3ad ae1;
#     }
# }
# ge-0/0/3 {
#     ether-options {
#         802.3ad {
#             ae2;
#             primary;
#         }
#     }
# }
# ge-0/0/4 {
#     ether-options {
#         802.3ad {
#             ae2;
#             backup;
#         }
#     }
# }
# ge-1/0/0 {
#     unit 0 {
#         family inet {
#             address 192.168.100.1/24;
#             address 10.200.16.20/24;
#         }
#         family inet6;
#     }
# }
# ge-2/0/0 {
#     unit 0 {
#         family inet {
#             address 192.168.100.2/24;
#             address 10.200.16.21/24;
#         }
#         family inet6;
#     }
# }
# ge-3/0/0 {
#     unit 0 {
#         family inet {
#             address 192.168.100.3/24;
#             address 10.200.16.22/24;
#         }
#         family inet6;
#     }
# }
# ae1 {
#     description "Configured by Ansible";
#     aggregated-ether-options {
#         lacp {
#             active;
#         }
#     }
# }
# ae2 {
#     description "Configured by Ansible";
#     aggregated-ether-options {
#         link-protection;
#         lacp {
#             passive;
#         }
#     }
# }
# em1 {
#     description TEST;
# }
# fxp0 {
#     description ANSIBLE;
#     speed 1g;
#     link-mode automatic;
#     unit 0 {
#         family inet {
#             address 10.8.38.38/24;
#         }
#     }
# }
- name: Gather junos lag interfaces as in given arguments
  junipernetworks.junos.junos_lag_interfaces:
    state: gathered
# Task Output (redacted)
# -----------------------
#
# "gathered": [
#         {
#             "members": [
#                 {
#                     "member": "ge-0/0/1"
#                 },
#                 {
#                     "member": "ge-0/0/2"
#                 }
#             ],
#             "mode": "active",
#             "name": "ae1"
#         },
#         {
#             "link_protection": true,
#             "members": [
#                 {
#                     "link_type": "primary",
#                     "member": "ge-0/0/3"
#                 },
#                 {
#                     "link_type": "backup",
#                     "member": "ge-0/0/4"
#                 }
#             ],
#             "mode": "passive",
#             "name": "ae2"
#         }
#     ]
# After state:
# ------------
#
# ansible@cm123456tr21# show interfaces
# ge-0/0/1 {
#     ether-options {
#         802.3ad ae1;
#     }
# }
# ge-0/0/2 {
#     ether-options {
#         802.3ad ae1;
#     }
# }
# ge-0/0/3 {
#     ether-options {
#         802.3ad {
#             ae2;
#             primary;
#         }
#     }
# }
# ge-0/0/4 {
#     ether-options {
#         802.3ad {
#             ae2;
#             backup;
#         }
#     }
# }
# ge-1/0/0 {
#     unit 0 {
#         family inet {
#             address 192.168.100.1/24;
#             address 10.200.16.20/24;
#         }
#         family inet6;
#     }
# }
# ge-2/0/0 {
#     unit 0 {
#         family inet {
#             address 192.168.100.2/24;
#             address 10.200.16.21/24;
#         }
#         family inet6;
#     }
# }
# ge-3/0/0 {
#     unit 0 {
#         family inet {
#             address 192.168.100.3/24;
#             address 10.200.16.22/24;
#         }
#         family inet6;
#     }
# }
# ae1 {
#     description "Configured by Ansible";
#     aggregated-ether-options {
#         lacp {
#             active;
#         }
#     }
# }
# ae2 {
#     description "Configured by Ansible";
#     aggregated-ether-options {
#         link-protection;
#         lacp {
#             passive;
#         }
#     }
# }
# em1 {
#     description TEST;
# }
# fxp0 {
#     description ANSIBLE;
#     speed 1g;
#     link-mode automatic;
#     unit 0 {
#         family inet {
#             address 10.8.38.38/24;
#         }
#     }
# }
# 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">
# <interfaces>
#         <interface>
#             <name>ge-0/0/1</name>
#             <ether-options>
#                 <ieee-802.3ad>
#                     <bundle>ae1</bundle>
#                 </ieee-802.3ad>
#             </ether-options>
#         </interface>
#         <interface>
#             <name>ge-0/0/2</name>
#             <ether-options>
#                 <ieee-802.3ad>
#                     <bundle>ae1</bundle>
#                 </ieee-802.3ad>
#             </ether-options>
#         </interface>
#         <interface>
#             <name>ge-0/0/3</name>
#             <ether-options>
#                 <ieee-802.3ad>
#                     <bundle>ae2</bundle>
#                     <primary/>
#                 </ieee-802.3ad>
#             </ether-options>
#         </interface>
#         <interface>
#             <name>ge-0/0/4</name>
#             <ether-options>
#                 <ieee-802.3ad>
#                     <bundle>ae2</bundle>
#                     <backup/>
#                 </ieee-802.3ad>
#             </ether-options>
#         </interface>
#         <interface>
#             <name>ge-1/0/0</name>
#             <unit>
#                 <name>0</name>
#                 <family>
#                     <inet>
#                         <address>
#                             <name>192.168.100.1/24</name>
#                         </address>
#                         <address>
#                             <name>10.200.16.20/24</name>
#                         </address>
#                     </inet>
#                     <inet6>
#                     </inet6>
#                 </family>
#             </unit>
#         </interface>
#         <interface>
#             <name>ge-2/0/0</name>
#             <unit>
#                 <name>0</name>
#                 <family>
#                     <inet>
#                         <address>
#                             <name>192.168.100.2/24</name>
#                         </address>
#                         <address>
#                             <name>10.200.16.21/24</name>
#                         </address>
#                     </inet>
#                     <inet6>
#                     </inet6>
#                 </family>
#             </unit>
#         </interface>
#         <interface>
#             <name>ge-3/0/0</name>
#             <unit>
#                 <name>0</name>
#                 <family>
#                     <inet>
#                         <address>
#                             <name>192.168.100.3/24</name>
#                         </address>
#                         <address>
#                             <name>10.200.16.22/24</name>
#                         </address>
#                     </inet>
#                     <inet6>
#                     </inet6>
#                 </family>
#             </unit>
#         </interface>
#         <interface>
#             <name>ae1</name>
#             <description>Configured by Ansible</description>
#             <aggregated-ether-options>
#                 <lacp>
#                     <active/>
#                 </lacp>
#             </aggregated-ether-options>
#         </interface>
#         <interface>
#             <name>ae2</name>
#             <description>Configured by Ansible</description>
#             <aggregated-ether-options>
#                 <link-protection>
#                 </link-protection>
#                 <lacp>
#                     <passive/>
#                 </lacp>
#             </aggregated-ether-options>
#         </interface>
#         <interface>
#             <name>em1</name>
#             <description>TEST</description>
#         </interface>
#         <interface>
#             <name>fxp0</name>
#             <description>ANSIBLE</description>
#             <speed>1g</speed>
#             <link-mode>automatic</link-mode>
#             <unit>
#                 <name>0</name>
#                 <family>
#                     <inet>
#                         <address>
#                             <name>10.8.38.38/24</name>
#                         </address>
#                     </inet>
#                 </family>
#             </unit>
#         </interface>
#     </interfaces>
#     </configuration>
# </rpc-reply>
# - name: Convert interfaces config to argspec without connecting to the appliance
#   junipernetworks.junos.junos_lag_interfaces:
#     running_config: "{{ lookup('file', './parsed.cfg') }}"
#     state: parsed
# Task Output (redacted)
# -----------------------
# "parsed": [
#         {
#             "members": [
#                 {
#                     "member": "ge-0/0/1"
#                 },
#                 {
#                     "member": "ge-0/0/2"
#                 }
#             ],
#             "mode": "active",
#             "name": "ae1"
#         },
#         {
#             "link_protection": true,
#             "members": [
#                 {
#                     "link_type": "primary",
#                     "member": "ge-0/0/3"
#                 },
#                 {
#                     "link_type": "backup",
#                     "member": "ge-0/0/4"
#                 }
#             ],
#             "mode": "passive",
#             "name": "ae2"
#         }
#     ]
# Using rendered
- name: Render platform specific xml from task input using rendered state
  junipernetworks.junos.junos_lag_interfaces:
    config:
      - name: ae1
        members:
          - member: ge-0/0/1
          - member: ge-0/0/2
        mode: active

      - name: ae2
        link_protection: true
        members:
          - member: ge-0/0/3
            link_type: primary
          - member: ge-0/0/4
            link_type: backup
        mode: passive
# Task Output (redacted)
# -----------------------
# "rendered": "<nc:interfaces
#     xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
#     <nc:interface>
#         <nc:name>ae1</nc:name>
#         <nc:aggregated-ether-options>
#             <nc:lacp>
#                 <nc:active/>
#             </nc:lacp>
#         </nc:aggregated-ether-options>
#     </nc:interface>
#     <nc:interface>
#         <nc:name>ge-0/0/1</nc:name>
#         <nc:ether-options>
#             <nc:ieee-802.3ad>
#                 <nc:bundle>ae1</nc:bundle>
#             </nc:ieee-802.3ad>
#         </nc:ether-options>
#     </nc:interface>
#     <nc:interface>
#         <nc:name>ge-0/0/2</nc:name>
#         <nc:ether-options>
#             <nc:ieee-802.3ad>
#                 <nc:bundle>ae1</nc:bundle>
#             </nc:ieee-802.3ad>
#         </nc:ether-options>
#     </nc:interface>
#     <nc:interface>
#         <nc:name>ae2</nc:name>
#         <nc:aggregated-ether-options>
#             <nc:lacp>
#                 <nc:passive/>
#             </nc:lacp>
#             <nc:link-protection/>
#         </nc:aggregated-ether-options>
#     </nc:interface>
#     <nc:interface>
#         <nc:name>ge-0/0/3</nc:name>
#         <nc:ether-options>
#             <nc:ieee-802.3ad>
#                 <nc:bundle>ae2</nc:bundle>
#                 <nc:primary/>
#             </nc:ieee-802.3ad>
#         </nc:ether-options>
#     </nc:interface>
#     <nc:interface>
#         <nc:name>ge-0/0/4</nc:name>
#         <nc:ether-options>
#             <nc:ieee-802.3ad>
#                 <nc:bundle>ae2</nc:bundle>
#                 <nc:backup/>
#             </nc:ieee-802.3ad>
#         </nc:ether-options>
#     </nc:interface>
# </nc:interfaces>"

Значения возврата

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

Ключ

Описание

after

список / элементы=строка

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

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

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

before

список / элементы=строка

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

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

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

xml

список / элементы=строка

Набор xml rpc данных, отправленных на удалённое устройство.

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

Пример: ["<nc:interfaces xmlns:nc=\"urn:ietf:params:xml:ns:netconf:base:1.0\"> <nc:interface> <nc:name>ae1</nc:name> <nc:aggregated-ether-options> <nc:lacp> <nc:active/> </nc:lacp> </nc:aggregated-ether-options> </nc:interface> <nc:interface> <nc:name>ge-0/0/1</nc:name> <nc:ether-options> <nc:ieee-802.3ad> <nc:bundle>ae1</nc:bundle> </nc:ieee-802.3ad> </nc:ether-options> </nc:interface> <nc:interface> <nc:name>ge-0/0/2</nc:name> <nc:ether-options> <nc:ieee-802.3ad> <nc:bundle>ae1</nc:bundle> </nc:ieee-802.3ad> </nc:ether-options> </nc:interface> <nc:interface> <nc:name>ae2</nc:name> <nc:aggregated-ether-options> <nc:lacp> <nc:passive/> </nc:lacp> <nc:link-protection/> </nc:aggregated-ether-options> </nc:interface> <nc:interface> <nc:name>ge-0/0/3</nc:name> <nc:ether-options> <nc:ieee-802.3ad> <nc:bundle>ae2</nc:bundle> <nc:primary/> </nc:ieee-802.3ad> </nc:ether-options> </nc:interface> <nc:interface> <nc:name>ge-0/0/4</nc:name> <nc:ether-options> <nc:ieee-802.3ad> <nc:bundle>ae2</nc:bundle> <nc:backup/> </nc:ieee-802.3ad> </nc:ether-options> </nc:interface> </nc:interfaces>", "xml 2", "xml 3"]

Авторы

  • Ganesh Nalawade (@ganeshrn)

Ссылки на сборку

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

© 2012–2018 Michael DeHaan
© 2018–2024 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/collections/junipernetworks/junos/junos_lag_interfaces_module.html

Spec-Zone.ru

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