grpc_get¶
Collection Note
This module is part of the ansible.netcommon collection. To install the collection, use:
Added in version3.1.0.
You need further requirements to be able to use this module, see the Requirements section for details.
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.
Requirements¶
The following Python packages are needed on the host that executes this module:
Parameters¶
| Parameter | Defaults / Choices | Comments |
|---|---|---|
| command str |
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. | |
| data_type str |
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 I(config), I(oper) etc. based on what is supported by the gRPC server. By default it will return both configuration and operational state data in response. | |
| display str |
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 I(json), I(text) etc. | |
| section str |
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¶
| Key | Data Type | Description | Returned |
|---|---|---|---|
| output | list | A dictionary representing a JSON-formatted response, if the response is a valid json string | when the device response is valid JSON |
| stdout | str | The raw string containing configuration or state data received from the gRPC server. | always apart from low-level errors (such as action plugin) |
| stdout_lines | list | The value of stdout split into a list | always apart from low-level errors (such as action plugin) |
Authors¶
- Ganesh Nalawade (@ganeshrn)
- Gomathi Selvi S (@gomathiselvis)