Skip to content

Latest commit

 

History

History
284 lines (236 loc) · 9.54 KB

cisco.iosxr.iosxr_cliconf.rst

File metadata and controls

284 lines (236 loc) · 9.54 KB

cisco.iosxr.iosxr

Use iosxr cliconf to run command on Cisco IOS XR platform

Version added: 1.0.0

  • This iosxr plugin provides low level abstraction apis for sending and receiving CLI commands from Cisco IOS XR network devices.
Parameter Choices/Defaults Configuration Comments
commit_comment
string
env:ANSIBLE_IOSXR_COMMIT_COMMENT
var: ansible_iosxr_commit_comment
Adds comment to commit confirmed..
commit_confirmed
boolean
Default:
"no"
env:ANSIBLE_IOSXR_COMMIT_CONFIRMED
var: ansible_iosxr_commit_confirmed
enable or disable commit confirmed mode
commit_confirmed_timeout
integer
env:ANSIBLE_IOSXR_COMMIT_CONFIRMED_TIMEOUT
var: ansible_iosxr_commit_confirmed_timeout
Commits the configuration on a trial basis for the time specified in seconds or minutes.
commit_label
string
env:ANSIBLE_IOSXR_COMMIT_LABEL
var: ansible_iosxr_commit_label
Adds label to commit confirmed.
config_commands
list / elements=string
added in 2.0.0
Default:
[]
var: ansible_iosxr_config_commands
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.
config_mode_exclusive
boolean
Default:
"no"
env:ANSIBLE_IOSXR_CONFIG_MODE_EXCLUSIVE
var: ansible_iosxr_config_mode_exclusive
enable or disable config mode exclusive

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.
# 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

Authors

  • Ansible Networking Team (@ansible-network)

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.