.. _ansible.netcommon.grpc_connection:
**********************
ansible.netcommon.grpc
**********************
**Provides a persistent connection using the gRPC protocol**
Version added: 3.1.0
.. contents::
:local:
:depth: 1
Synopsis
--------
- This connection plugin provides a connection to remote devices over gRPC and is typically used with devices for sending and receiving RPC calls over gRPC framework.
- Note this connection plugin requires the grpcio python library to be installed on the local Ansible controller.
Requirements
------------
The below requirements are needed on the local Ansible controller node that executes this connection.
- grpcio
- protobuf
Parameters
----------
.. raw:: html
| Parameter |
Choices/Defaults |
Configuration |
Comments |
|
certificate_chain_file
string
|
|
ini entries:
[grpc_connection] certificate_chain_file = VALUE
env:ANSIBLE_CERTIFICATE_CHAIN_FILE
var: ansible_certificate_chain_file
|
The PEM encoded certificate chain file used to create a SSL-enabled channel. If the value is None, no certificate chain is used.
|
|
grpc_type
-
|
Default:
"no"
|
ini entries:
[grpc_connection] type = no
env:ANSIBLE_GRPC_CONNECTION_TYPE
var: ansible_grpc_connection_type
|
This option indicates the grpc type and it can be used in place of network_os. (example cisco.iosxr.iosxr)
|
|
host
string
|
Default:
"inventory_hostname"
|
var: ansible_host
|
Specifies the remote device FQDN or IP address to establish the gRPC connection to.
|
|
import_modules
boolean
|
Default:
"yes"
|
ini entries:
[ansible_network] import_modules = yes
env:ANSIBLE_NETWORK_IMPORT_MODULES
var: ansible_network_import_modules
|
Reduce CPU usage and network module execution time by enabling direct execution. Instead of the module being packaged and executed by the shell, it will be directly executed by the Ansible control node using the same python interpreter as the Ansible process. Note- Incompatible with asynchronous mode. Note- Python 3 and Ansible 2.9.16 or greater required. Note- With Ansible 2.9.x fully qualified modules names are required in tasks.
|
|
network_os
string
|
|
var: ansible_network_os
|
Configures the device platform network operating system. This value is used to load a device specific grpc plugin to communicate with the remote device.
|
|
password
string
|
|
var: ansible_password
var: ansible_ssh_pass
|
Configures the user password used to authenticate to the remote device when first establishing the gRPC connection.
|
|
persistent_command_timeout
integer
|
Default:
30
|
ini entries:
[persistent_connection] command_timeout = 30
env:ANSIBLE_PERSISTENT_COMMAND_TIMEOUT
var: ansible_command_timeout
|
Configures, in seconds, the amount of time to wait for a command to return from the remote device. If this timer is exceeded before the command returns, the connection plugin will raise an exception and close.
|
|
persistent_connect_timeout
integer
|
Default:
30
|
ini entries:
[persistent_connection] connect_timeout = 30
env:ANSIBLE_PERSISTENT_CONNECT_TIMEOUT
var: ansible_connect_timeout
|
Configures, in seconds, the amount of time to wait when trying to initially establish a persistent connection. If this value expires before the connection to the remote device is completed, the connection will fail.
|
|
persistent_log_messages
boolean
|
Default:
"no"
|
ini entries:
[persistent_connection] log_messages = no
env:ANSIBLE_PERSISTENT_LOG_MESSAGES
var: ansible_persistent_log_messages
|
This flag will enable logging the command executed and response received from target device in the ansible log file. For this option to work 'log_path' ansible configuration option is required to be set to a file path with write access.
Be sure to fully understand the security implications of enabling this option as it could create a security vulnerability by logging sensitive information in log file.
|
|
port
integer
|
|
ini entries:
[defaults] remote_port = VALUE
env:ANSIBLE_REMOTE_PORT
var: ansible_port
|
Specifies the port on the remote device that listens for connections when establishing the gRPC connection. If None only the host part will be used.
|
|
private_key_file
string
|
|
ini entries:
[grpc_connection] private_key_file = VALUE
env:ANSIBLE_PRIVATE_KEY_FILE
var: ansible_private_key_file
|
The PEM encoded private key file used to authenticate to the remote device when first establishing the grpc connection.
|
|
remote_user
string
|
|
ini entries:
[defaults] remote_user = VALUE
env:ANSIBLE_REMOTE_USER
var: ansible_user
|
The username used to authenticate to the remote device when the gRPC connection is first established. If the remote_user is not specified, the connection will use the username of the logged in user.
Can be configured from the CLI via the --user or -u options.
|
|
root_certificates_file
string
|
|
ini entries:
[grpc_connection] root_certificates_file = VALUE
env:ANSIBLE_ROOT_CERTIFICATES_FILE
var: ansible_root_certificates_file
|
The PEM encoded root certificate file used to create a SSL-enabled channel, if the value is None it reads the root certificates from a default location chosen by gRPC at runtime.
|
|
ssl_target_name_override
string
|
|
ini entries:
[grpc_connection] ssl_target_name_override = VALUE
env:ANSIBLE_GPRC_SSL_TARGET_NAME_OVERRIDE
var: ansible_grpc_ssl_target_name_override
|
The option overrides SSL target name used for SSL host name checking. The name used for SSL host name checking will be the target parameter (assuming that the secure channel is an SSL channel). If this parameter is specified and the underlying is not an SSL channel, it will just be ignored.
|