cisco.radkit.genie_parsed_command module – Runs a command via RADKit, then through genie parser, returning a parsed result
Note
This module is part of the cisco.radkit collection (version 2.0.0).
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 git+https://wwwin-github.cisco.com/scdozier/cisco.radkit-ansible.git
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: cisco.radkit.genie_parsed_command
.
New in cisco.radkit 0.2.0
Synopsis
Runs a command via RADKit, then through genie parser, returning a parsed result
Supports both single device and multiple device command execution
Automatically fingerprints device OS or accepts explicit OS specification
Returns structured data through Genie parsers for network automation
Requirements
The below requirements are needed on the host that executes this module.
radkit
Parameters
Parameter |
Comments |
---|---|
Alternate path to client ca cert for RADKIT If the value is not specified in the task, the value of environment variable RADKIT_ANSIBLE_CLIENT_CA_PATH will be used instead. |
|
Alternate path to client cert for RADKIT If the value is not specified in the task, the value of environment variable RADKIT_ANSIBLE_CLIENT_CERT_PATH will be used instead. |
|
Client certificate password in base64 If the value is not specified in the task, the value of environment variable RADKIT_ANSIBLE_CLIENT_PRIVATE_KEY_PASSWORD_BASE64 will be used instead. |
|
Alternate path to client key for RADKIT If the value is not specified in the task, the value of environment variable RADKIT_ANSIBLE_CLIENT_KEY_PATH will be used instead. |
|
Commands to execute on device |
|
Name of device as it shows in RADKit inventory |
|
Specifies how many seconds RADKit will for command to complete Can optionally set via environemnt variable RADKIT_ANSIBLE_EXEC_TIMEOUT Default: |
|
Attrbute to match RADKit inventory, which can select multiple devices at once. (use with filter_pattern, ex ‘name’) |
|
Pattern to match RADKit inventory, which can select multiple devices at once. (use instead of device_name) |
|
Identity to authentiate with RADKit (xxxx@cisco.com). If the value is not specified in the task, the value of environment variable RADKIT_ANSIBLE_IDENTITY will be used instead. |
|
The device OS (if omitted, the OS found by fingerprint) Default: |
|
Removes the command and device keys from the returned value when running a single command against a single device. NOTE; This does not work with diff Choices:
|
|
Radkit service serial If the value is not specified in the task, the value of environment variable RADKIT_ANSIBLE_SERVICE_SERIAL will be used instead. |
|
Specifies how many seconds RADKit will wait before failing task. Note that the request is not affected, and it will still eventually complete (successfully or unsuccessfully) Can optionally set via environemnt variable RADKIT_ANSIBLE_WAIT_TIMEOUT Default: |
Examples
- name: Get parsed output from all routers starting with rtr-
cisco.radkit.genie_parsed_command:
commands: show version
filter_pattern: rtr-
filter_attr: name
os: iosxe
register: cmd_output
delegate_to: localhost
- name: Show output
debug:
msg: "{{ cmd_output }}"
- name: Get parsed output from rtr-csr1 with removed return keys
cisco.radkit.genie_parsed_command:
device_name: rtr-csr1
commands: show version
os: iosxe
remove_cmd_and_device_keys: yes
register: cmd_output
delegate_to: localhost
- name: Show IOS version
debug:
msg: "{{ cmd_output['genie_parsed_result']['version']['version'] }}"
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
Dictionary of results is returned if running command on multiple devices or with multiple commands Returned: success |
|
Command Returned: success |
|
Device in Radkit Returned: success |
|
Status of exec from RADKit Returned: success |
|
Status message from RADKit Returned: success |
|
Dictionary of parsed results Returned: success |