Spec-Zone.ru › Ansible

cisco.iosxr.iosxr cliconf – Использование iosxr cliconf для выполнения команд на платформе Cisco IOS XR

Примечание

Этот плагин cliconf является частью коллекции cisco.iosxr (версия 9.0.0).

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

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

Для использования в книге задач укажите: cisco.iosxr.iosxr.

Новинка в cisco.iosxr 1.0.0

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

Обзор

  • Этот плагин iosxr предоставляет низкоуровневые абстрактные API для отправки и получения команд CLI от сетевых устройств Cisco IOS XR.

Параметры

Параметр

Комментарии

commit_comment

строка

Добавляет комментарий к подтвержденному коммиту.

Конфигурация:

  • Переменная среды: ANSIBLE_IOSXR_COMMIT_COMMENT
  • Переменная: ansible_iosxr_commit_comment

commit_confirmed

логическое значение

Включить или выключить режим подтверждения коммита.

Варианты:

  • false ← (по умолчанию)
  • true

Конфигурация:

  • Переменная среды: ANSIBLE_IOSXR_COMMIT_CONFIRMED
  • Переменная: ansible_iosxr_commit_confirmed

commit_confirmed_timeout

целое число

Производит коммит конфигурации на пробной основе в течение указанного времени в секундах или минутах.

Конфигурация:

  • Переменная среды: ANSIBLE_IOSXR_COMMIT_CONFIRMED_TIMEOUT
  • Переменная: ansible_iosxr_commit_confirmed_timeout

commit_label

строка

Добавляет метку к подтвержденному коммиту.

Конфигурация:

  • Переменная среды: ANSIBLE_IOSXR_COMMIT_LABEL
  • Переменная: ansible_iosxr_commit_label
... ...

Примечания

Примечание

  • Команда IOSXR commit confirmed изменяется с выпуском IOSXR, commit_comment и commit_label могут или не могут быть действительны вместе в зависимости от версии устройства.

Примеры

# Use commit confirmed within a task with timeout, label and comment

- name: Commit confirmed with a task
  vars:
    ansible_iosxr_commit_confirmed: True
    ansible_iosxr_commit_confirmed_timeout: 50
    ansible_iosxr_commit_label: TestLabel
    ansible_iosxr_commit_comment: I am a test comment
  cisco.iosxr.iosxr_logging_global:
    state: merged
    config:
      buffered:
        severity: errors #alerts #informational
      correlator:
        buffer_size: 2024

# Commands (cliconf specific)
# ["commit confirmed 50 label TestLabel comment I am a test comment"]

# Use commit within a task with label

- name: Commit label with a task
  vars:
    ansible_iosxr_commit_label: lblTest
  cisco.iosxr.iosxr_hostname:
    state: merged
    config:
      hostname: R1

# Commands (cliconf specific)
# ["commit label lblt1"]

# Use commit confirm with timeout and confirm the commit

# NOTE - IOSXR waits for a `commit` when the command
# executed is `commit confirmed <timeout>` within the timeout
# period for the config to commit successfully, else a rollback
# happens.

- name: Example commit confirmed
  vars:
    ansible_iosxr_commit_confirmed: True
    ansible_iosxr_commit_confirmed_timeout: 60
  tasks:
    - name: "Commit confirmed with timeout"
      cisco.iosxr.iosxr_hostname:
        state: merged
        config:
          hostname: R1

    - name: "Confirm the Commit"
      cisco.iosxr.iosxr_command:
        commands:
          - commit

# Commands (cliconf specific)
# ["commit confirmed 60"]

# Use exclusive mode with a task

- name: Configure exclusive mode with a task
  vars:
    ansible_iosxr_config_mode_exclusive: True
  cisco.iosxr.iosxr_interfaces:
    state: merged
    config:
      - name: GigabitEthernet0/0/0/2
        description: Configured via Ansible
      - name: GigabitEthernet0/0/0/3
        description: Configured via Ansible

# Commands (cliconf specific)
# ["configure exclusive"]

# Use Replace option with commit confirmed

# NOTE - IOSXR waits for a `commit` when the command
# executed is `commit replace confirmed <timeout>` within the timeout
# period for the config to commit successfully, else a rollback
# happens.
# This option is supported by only iosxr_config module

- name: Example replace config with commit confirmed
  vars:
    ansible_iosxr_commit_confirmed: True
    ansible_iosxr_commit_confirmed_timeout: 60
  tasks:
    - name: "Replace config with Commit confirmed"
      cisco.iosxr.iosxr_config:
        src: 'replace_running_cfg_iosxr.txt'
        replace: config

    - name: "Confirm the Commit"
      cisco.iosxr.iosxr_command:
        commands:
          - commit

Авторы

  • Команда Ansible Networking (@ansible-network)

Подсказка

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

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

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

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

Spec-Zone.ru

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