cisco.iosxr.iosxr cliconf – Use iosxr cliconf to run command on Cisco IOS XR platform
Note
This cliconf plugin is part of the cisco.iosxr collection (version 9.0.0).
You might already have this collection installed if you are using the ansible
package.
It is not included in ansible-core
.
To check whether it is installed, run ansible-galaxy collection list
.
To install it, use: ansible-galaxy collection install cisco.iosxr
.
To use it in a playbook, specify: cisco.iosxr.iosxr
.
New in cisco.iosxr 1.0.0
Synopsis
This iosxr plugin provides low level abstraction apis for sending and receiving CLI commands from Cisco IOS XR network devices.
Parameters
Parameter |
Comments |
---|---|
Adds comment to commit confirmed.. Configuration:
|
|
enable or disable commit confirmed mode Choices:
Configuration:
|
|
Commits the configuration on a trial basis for the time specified in seconds or minutes. Configuration:
|
|
Adds label to commit confirmed. Configuration:
|
|
Specifies a list of commands that can make configuration changes to the target device. When `ansible_network_single_user_mode` is enabled, if a command sent to the device is present in this list, the existing cache is invalidated. Default: Configuration:
|
|
enable or disable config mode exclusive Choices:
Configuration:
|
Notes
Note
IOSXR commit confirmed command varies with IOSXR version releases, commit_comment and commit_label may or may not be valid together as per the device version.
Examples
# 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