cisco.radkit.genie_learn 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_learn.

New in cisco.radkit 0.2.0

Synopsis

  • Runs a command via RADKit, then through genie parser, returning a parsed result

Requirements

The below requirements are needed on the host that executes this module.

  • radkit

Parameters

Parameter

Comments

client_ca_path

string

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.

client_cert_path

string

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_key_password_b64

aliases: radkit_client_private_key_password_base64

string / required

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.

client_key_path

string

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.

device_name

string

Name of device as it shows in RADKit inventory

exec_timeout

integer

Specifies how many seconds RADKit will for command to complete

Can optionally set via environemnt variable RADKIT_ANSIBLE_EXEC_TIMEOUT

Default: 0

filter_attr

string

Attrbute to match RADKit inventory, which can select multiple devices at once. (use with filter_pattern, ex ‘name’)

filter_pattern

string

Pattern to match RADKit inventory, which can select multiple devices at once. (use instead of device_name)

identity

aliases: radkit_identity

string / required

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.

models

list / elements=string / required

models to execute on device

os

string

The device OS (if omitted, the OS found by fingerprint)

Default: "fingerprint"

remove_model_and_device_keys

boolean

Removes the model and device keys from the returned value when running a single model against a single device.

NOTE; This does not work with diff

Choices:

  • false ← (default)

  • true

service_serial

aliases: radkit_serial, radkit_service_serial

string / required

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.

wait_timeout

integer

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: 0

Examples

- name: Get parsed output from rtr-csr1 with removed return keys
  cisco.radkit.genie_learn:
    device_name: rtr-csr1
    models: platform
    os: iosxe
    remove_model_and_device_keys: yes
  register: cmd_output
  delegate_to: localhost

- name: Show Chassis Serial Number
  debug:
    msg: "{{ cmd_output['genie_learn_result']['chassis_sn'] }}"

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

ansible_module_results

dictionary

Dictionary of results is returned if running command on multiple devices or with multiple models

Returned: success

command

string

Command

Returned: success

device_name

string

Device in Radkit

Returned: success

exec_status

string

Status of exec from RADKit

Returned: success

exec_status_message

string

Status message from RADKit

Returned: success

genie_learn_result

dictionary

Dictionary of parsed results

Returned: success

Authors

  • Scott Dozier (@scdozier)