google.cloud.iap connection – connect via SSH through Google Cloud’s Identity Aware Proxy (IAP)
Note
This connection plugin is part of the google.cloud collection (version 1.13.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 google.cloud.
To use it in a playbook, specify: google.cloud.iap.
Synopsis
- This connection plugin behaves almost like the stock SSH plugin, but it creates a new IAP process per host in the inventory so connections are tunneled through it.
Parameters
Parameter | Comments |
|---|---|
control_path string | This is the location to save SSH’s ControlPath sockets, it uses SSH’s variable substitution. Be aware that this setting is ignored if Configuration:
|
control_path_dir string | This sets the directory to use for ssh control path if the control path setting is null. Also, provides the ``%(directory)s`` variable for the control path setting. Default: Configuration:
|
gcloud_access_token_file string | A file to read the access token from. The credentials of the active account (if exists) will be ignored. Configuration:
|
gcloud_account string | Google cloud account to use for invocation. Configuration:
|
gcloud_configuration string | If set, points to non-standard gcloud configuration. Configuration:
|
gcloud_executable string | Path to the gcloud executable, defaults to whatever is found in the PATH environment variable. Configuration:
|
gcloud_project string | The Google Cloud project ID to use for this invocation. If omitted, then the current active project is assumed. Configuration:
|
gcloud_zone string | The Google Cloud zone to use for the instance(s). Configuration:
|
host string | Google Cloud instance name to connect to. Default: Configuration:
|
host_key_checking boolean | Determines if SSH should reject or not a connection after checking host keys. Choices:
Configuration:
|
known_hosts_file string | Path to the UserKnownHosts file storing SSH fingerprints. Defaults to the same file used by `gcloud compute ssh` Default: Configuration:
|
password string | Authentication password for the Configuration:
|
password_mechanism string | Mechanism to use for handling ssh password prompt Choices:
Configuration:
|
pipelining boolean | Pipelining reduces the number of connection operations required to execute a module on the remote server, by executing many Ansible modules without actual file transfers. This can result in a very significant performance improvement when enabled. However this can conflict with privilege escalation ( Choices:
Configuration:
|
pkcs11_provider string | PKCS11 SmartCard provider such as opensc, e.g. /usr/local/lib/opensc-pkcs11.so Default: Configuration:
|
port integer | Remote port to connect to. Configuration:
|
private_key string | Private key contents in PEM format. Requires the Configuration:
|
private_key_file string | Path to private key file to use for authentication. Default: Configuration:
|
private_key_passphrase string | Private key passphrase, dependent on This does NOT have any effect when used with Configuration:
|
reconnection_retries integer | Number of attempts to connect. Ansible retries connections only if it gets an SSH error with a return code of 255. Any errors with return codes other than 255 indicate an issue with program execution. Default: Configuration:
|
remote_user string | User name with which to login to the remote server, normally set by the remote_user keyword. If no user is supplied, Ansible will let the SSH client binary choose the user as it normally. Configuration:
|
scp_executable string | This defines the location of the scp binary. It defaults to Default: Configuration:
|
scp_extra_args string | Extra exclusive to the Default: Configuration:
|
scp_if_ssh string | Fallback to SCP (Secure Copy Protocol) when SFTP is not available. When enabled and SFTP fails, Ansible will try to use SCP for file transfers. Default: Configuration:
|
sftp_batch_mode boolean | When set to When set to Choices:
Configuration:
|
sftp_executable string | This defines the location of the sftp binary. It defaults to Default: Configuration:
|
sftp_extra_args string | Extra exclusive to the Default: Configuration:
|
ssh_args string | arguments to pass to all ssh cli tools. Default: Configuration:
|
ssh_common_args string | common extra args for all ssh cli tools. Default: Configuration:
|
ssh_executable string | This defines the location of the SSH binary. It defaults to This option is usually not required, it might be useful when access to system SSH is restricted, or when using SSH wrappers to connect to remote hosts. Default: Configuration:
|
ssh_extra_args string | Extra exclusive to the SSH CLI. Default: Configuration:
|
ssh_transfer_method string | Preferred method to use when transferring files over ssh Choices:
Configuration:
|
sshpass_prompt string | Password prompt that Supported by sshpass 1.06 and up when Defaults to Defaults to Default: Configuration:
|
timeout integer | This is the default amount of time we will wait while establishing an SSH connection. It also controls how long we can wait to access reading the connection once established (select on the socket). Default: Configuration:
|
use_tty boolean | add -tt to ssh commands to force tty allocation. Choices:
Configuration:
|
verbosity integer | Requested verbosity level for the SSH CLI. Default: Configuration:
|
Note
Configuration entries listed above for each entry type (Ansible variable, environment variable, and so on) have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up. The entry types are also ordered by precedence from low to high priority order. For example, an ansible.cfg entry (further up in the list) is overwritten by an Ansible variable (further down in the list).
Notes
Note
- This plugin requires you to have configured gcloud authentication prior to using it. You can change the active configuration used, but the plugin won’t auth for you.
- This plugin is mostly a wrapper to the ``ssh`` CLI utility and the exact behavior of the options depends on this tool. This means that the documentation provided here is subject to be overridden by the CLI tool itself.
- Many options default to
Nonehere but that only means we do not override the SSH tool’s defaults and/or configuration. For example, if you specify the port in this plugin it will override anyPortentry in your.ssh/config. - The ssh CLI tool uses return code 255 as a ‘connection error’, this can conflict with commands/tools that also return 255 as an error code and will look like an ‘unreachable’ condition or ‘connection error’ to this plugin.
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/google/cloud/iap_connection.html