cisco.ios.ios (8.0.0) — cliconf

Use ios cliconf to run command on Cisco IOS platform

| "added in version" 1.0.0 of cisco.ios"

Authors: Ansible Networking Team (@ansible-network)

Install collection

Install with ansible-galaxy collection install cisco.ios:==8.0.0


Add to requirements.yml

  collections:
    - name: cisco.ios
      version: 8.0.0

Description

This ios plugin provides low level abstraction apis for sending and receiving CLI commands from Cisco IOS network devices.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# NOTE - IOS waits for a `configure confirm` when the configure terminal
# command executed is `configure terminal revert timer <timeout>` within the timeout
# period for the configuration to commit successfully, else a rollback
# happens.

# Use commit confirm with timeout and confirm the commit explicitly

- name: Example commit confirmed
  vars:
    ansible_ios_commit_confirm_timeout: 1
  tasks:
    - name: "Commit confirmed with timeout"
      cisco.ios.ios_hostname:
        state: merged
        config:
          hostname: R1

    - name: "Confirm the Commit"
      cisco.ios.ios_command:
        commands:
          - configure confirm
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Commands fired
# - configure terminal revert timer 1 (cliconf specific)
# - hostname R1 (from hostname resource module)
# - configure confirm (from ios_command module)

# Use commit confirm with timeout and confirm the commit via cliconf

- name: Example commit confirmed
  vars:
    ansible_ios_commit_confirm_immediate: True
    ansible_ios_commit_confirm_timeout: 3
  tasks:
    - name: "Commit confirmed with timeout"
      cisco.ios.ios_hostname:
        state: merged
        config:
          hostname: R1
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Commands fired
# - configure terminal revert timer 3 (cliconf specific)
# - hostname R1 (from hostname resource module)
# - configure confirm (cliconf specific)

# Use commit confirm via cliconf using default timeout

- name: Example commit confirmed
  vars:
    ansible_ios_commit_confirm_immediate: True
  tasks:
    - name: "Commit confirmed with timeout"
      cisco.ios.ios_hostname:
        state: merged
        config:
          hostname: R1

Inputs

    
config_commands:
    default: []
    description:
    - 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.
    elements: str
    type: list
    vars:
    - name: ansible_ios_config_commands
    version_added: 2.0.0
    version_added_collection: cisco.ios

commit_confirm_timeout:
    description:
    - Commits the configuration on a trial basis for the time specified in minutes.
    - Using commit_confirm_timeout without specifying commit_confirm_immediate would need
      an explicit C(configure confirm) using the ios_command module to confirm/commit
      the changes made.
    - Refer to example for a use case demonstration.
    env:
    - name: ANSIBLE_IOS_COMMIT_CONFIRM_TIMEOUT
    type: int
    vars:
    - name: ansible_ios_commit_confirm_timeout

commit_confirm_immediate:
    default: false
    description:
    - Enable or disable commit confirm mode.
    - Confirms the configuration pushed after a custom/ default timeout.(default 1 minute).
    - For custom timeout configuration set commit_confirm_timeout value.
    - On commit_confirm_immediate default value for commit_confirm_timeout is considered
      1 minute when variable in not explicitly declared.
    env:
    - name: ANSIBLE_IOS_COMMIT_CONFIRM_IMMEDIATE
    type: boolean
    vars:
    - name: ansible_ios_commit_confirm_immediate