ansible / ansible.netcommon / 6.1.0 / module / grpc_get Fetch configuration/state data from gRPC enabled target hosts. | "added in version" 3.1.0 of ansible.netcommon" Authors: Ganesh Nalawade (@ganeshrn), Gomathi Selvi S (@GomathiselviS) This plugin has a corresponding action plugin.ansible.netcommon.grpc_get (6.1.0) — module
Install with ansible-galaxy collection install ansible.netcommon:==6.1.0
collections: - name: ansible.netcommon version: 6.1.0
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.
- 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
command: description: - 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. type: str display: description: - 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. type: str section: aliases: - filter description: - 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. type: str data_type: description: - 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. type: str
output: 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: "[{\n \"Cisco-IOS-XR-ip-static-cfg:router-static\": {\n \"default-vrf\"\ : {\n \"address-family\": {\n \"vrfipv4\": {\n \ \ \"vrf-unicast\": {\n \"vrf-prefixes\":\ \ {\n \"vrf-prefix\": [\n \ \ {\n \"prefix\": \"0.0.0.0\",\n \ \ \"prefix-length\": 0,\n \ \ \"vrf-route\": {\n \"vrf-next-hop-table\"\ : {\n \"vrf-next-hop-interface-name-next-hop-address\"\ : [\n {\n \ \ \"interface-name\": \"MgmtEth0/RP0/CPU0/0\",\n\ \ \"next-hop-address\": \"\ 10.0.2.2\"\n }\n \ \ ]\n }\n\ \ }\n }\n \ \ ]\n }\n }\n\ \ }\n }\n }\n }\n}]\n" type: list stdout: description: 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: '...' type: str stdout_lines: description: The value of stdout split into a list returned: always apart from low-level errors (such as action plugin) sample: - '...' - '...' type: list