cisco.iosxr.iosxr cliconf — Использование iosxr cliconf для выполнения команд на платформе Cisco IOS XR
Примечание
Этот плагин cliconf входит в коллекцию cisco.iosxr (версия 12.3.1).
Возможно, эта коллекция уже установлена, если вы используете пакет 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 string | Добавляет комментарий к commit confirmed. Конфигурация:
|
commit_confirmed boolean | Включает или отключает режим commit confirmed Варианты:
Конфигурация:
|
commit_confirmed_timeout integer | Применяет конфигурацию в пробном режиме на указанный срок в секундах или минутах. Конфигурация:
|
commit_label string | Добавляет метку к commit confirmed. Конфигурация:
|
config_commands list / элементы=string добавлено в cisco.iosxr 2.0.0 | Задаёт список команд, которые могут вносить изменения в конфигурацию целевого устройства. Если включён параметр `ansible_network_single_user_mode`, а отправленная устройству команда содержится в этом списке, существующий кэш будет сброшен. По умолчанию: Конфигурация:
|
config_mode_exclusive boolean | Включает или отключает исключительный режим конфигурации Варианты:
Конфигурация:
|
Примечание
Перечисленные выше для каждого типа записей конфигурации (переменная Ansible, переменная среды и т. д.) имеют приоритет от низкого к высокому. Например, переменная, расположенная ниже в списке, переопределяет переменную, расположенную выше. Типы записей также упорядочены по приоритету от низкого к высокому. Например, запись ansible.cfg (расположенная выше в списке) переопределяется переменной Ansible (расположенной ниже в списке).
Примечания
Примечание
- Команда commit confirmed в IOSXR различается в зависимости от версии 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
Ссылки на коллекцию
© 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_cliconf.html