ansible.netcommon.grpc_get module – Fetch configuration/state data from gRPC enabled target hosts.
Note
This module is part of the ansible.netcommon collection (version 7.1.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 ansible.netcommon
.
You need further requirements to be able to use this module,
see Requirements for details.
To use it in a playbook, specify: ansible.netcommon.grpc_get
.
New in ansible.netcommon 3.1.0
Synopsis
gRPC is a high performance, open-source universal RPC framework.
This module allows the user to fetch configuration and state data from gRPC enabled devices.
Note
This module has a corresponding action plugin.
Requirements
The below requirements are needed on the host that executes this module.
grpcio
protobuf
Parameters
Parameter |
Comments |
---|---|
The option specifies the command to be executed on the target host and return the response in result. This option is supported if the gRPC target host supports executing CLI command over the gRPC connection. |
|
The type of data that should be fetched from the target host. The value depends on the capability of the gRPC server running on target host. The values can be config, oper etc. based on what is supported by the gRPC server. By default it will return both configuration and operational state data in response. |
|
Encoding scheme to use when serializing output from the device. The encoding scheme value depends on the capability of the gRPC server running on the target host. The values can be json, text etc. |
|
This option specifies the string which acts as a filter to restrict the portions of the data to be retrieved from the target host device. If this option is not specified the entire configuration or state data is returned in response provided it is supported by target host. |
Notes
Note
This module requires the gRPC system service be enabled on the target host being managed.
This module supports the use of connection=ansible.netcommon.grpc.
This module requires the value of ‘ansible_network_os or grpc_type’ configuration option (refer ansible.netcommon.grpc connection plugin documentation) be defined as an inventory variable.
Tested against iosxrv 9k version 6.1.2.
Examples
- name: Get bgp configuration data
grpc_get:
section:
Cisco-IOS-XR-ip-static-cfg:router-static:
- null
- name: run cli command
grpc_get:
command: "show version"
display: text
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key |
Description |
---|---|
A dictionary representing a JSON-formatted response, if the response is a valid json string Returned: when the device response is valid JSON Sample: |
|
The raw string containing configuration or state data received from the gRPC server. Returned: always apart from low-level errors (such as action plugin) Sample: |
|
The value of stdout split into a list Returned: always apart from low-level errors (such as action plugin) Sample: |