Skip to content

Latest commit

 

History

History
459 lines (432 loc) · 20.6 KB

ansible.netcommon.libssh_connection.rst

File metadata and controls

459 lines (432 loc) · 20.6 KB

ansible.netcommon.libssh

Run tasks using libssh for ssh connection

Version added: 1.1.0

  • Use the ansible-pylibssh python bindings to connect to targets
  • The python bindings use libssh C library (https://www.libssh.org/) to connect to targets
  • This plugin borrows a lot of settings from the ssh plugin as they both cover the same protocol.
Parameter Choices/Defaults Configuration Comments
config_file
path
added in 5.1.0
ini entries:

[libssh_connection]
config_file = VALUE

env:ANSIBLE_LIBSSH_CONFIG_FILE
var: ansible_libssh_config_file
Alternate SSH config file location
host_key_auto_add
boolean
ini entries:

[libssh_connection]
host_key_auto_add = VALUE

env:ANSIBLE_LIBSSH_HOST_KEY_AUTO_ADD
TODO: write it
host_key_checking
boolean
Default:
"yes"
ini entries:

[defaults]
host_key_checking = yes

[libssh_connection]
host_key_checking = yes

env:ANSIBLE_HOST_KEY_CHECKING
env:ANSIBLE_SSH_HOST_KEY_CHECKING
env:ANSIBLE_LIBSSH_HOST_KEY_CHECKING
var: ansible_host_key_checking
var: ansible_ssh_host_key_checking
var: ansible_libssh_host_key_checking
Set this to "False" if you want to avoid host key checking by the underlying tools Ansible uses to connect to the host
hostkeys
string
Default:
""
ini entries:

[libssh_connection]
hostkeys =

env:ANSIBLE_LIBSSH_HOSTKEYS
var: ansible_libssh_hostkeys
Set the preferred server host key types as a comma-separated list (e.g., ssh-rsa,ssh-dss,ecdh-sha2-nistp256).
key_exchange_algorithms
string
ini entries:

[libssh_connection]
key_exchange_algorithms = VALUE

env:ANSIBLE_LIBSSH_KEY_EXCHANGE_ALGORITHMS
var: ansible_libssh_key_exchange_algorithms
Set the key exchange method as a comma-separated list (e.g., "ecdh-sha2-nistp256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1").
The list can be prepended by +,-,^ which will append, remove or move to the beginning (prioritizing) of the default list respectively. Giving an empty list after + and ^ will cause error.
look_for_keys
boolean
Default:
"yes"
ini entries:

[libssh_connection]
look_for_keys = yes

env:ANSIBLE_LIBSSH_LOOK_FOR_KEYS
TODO: write it
password
string
var: ansible_password
var: ansible_ssh_pass
var: ansible_ssh_password
var: ansible_libssh_pass
var: ansible_libssh_password
Secret used to either login the ssh server or as a passphrase for ssh keys that require it
Can be set from the CLI via the --ask-pass option.
password_prompt
string
added in 3.1.0
var: ansible_libssh_password_prompt
Text to match when using keyboard-interactive authentication to determine if the prompt is for the password.
Requires ansible-pylibssh version >= 1.0.0
proxy_command
string
Default:
""
ini entries:

[libssh_connection]
proxy_command =

env:ANSIBLE_LIBSSH_PROXY_COMMAND
var: ansible_paramiko_proxy_command
var: ansible_libssh_proxy_command
Proxy information for running the connection via a jumphost.
Also this plugin will scan 'ssh_args', 'ssh_extra_args' and 'ssh_common_args' from the 'ssh' plugin settings for proxy information if set.
pty
boolean
Default:
"yes"
ini entries:

[libssh_connection]
pty = yes

env:ANSIBLE_LIBSSH_PTY
TODO: write it
publickey_accepted_algorithms
string
Default:
""
ini entries:

[libssh_connection]
publickey_algorithms =

env:ANSIBLE_LIBSSH_PUBLICKEY_ALGORITHMS
var: ansible_libssh_publickey_algorithms
List of algorithms to forward to SSH_OPTIONS_PUBLICKEY_ACCEPTED_TYPES.
remote_addr
string
Default:
"inventory_hostname"
var: inventory_hostname
var: ansible_host
var: ansible_ssh_host
var: ansible_libssh_host
Address of the remote target
remote_user
string
ini entries:

[defaults]
remote_user = VALUE

[libssh_connection]
remote_user = VALUE

env:ANSIBLE_REMOTE_USER
env:ANSIBLE_LIBSSH_REMOTE_USER
var: ansible_user
var: ansible_ssh_user
var: ansible_libssh_user
User to login/authenticate as
Can be set from the CLI via the --user or -u options.
ssh_args
string
added in 3.2.0
ini entries:

[ssh_connection]
ssh_args = VALUE

env:ANSIBLE_SSH_ARGS
var: ansible_ssh_args
Arguments to pass to all ssh CLI tools.
ProxyCommand is the only supported argument.
This option is deprecated in favor of proxy_command and will be removed in a release after 2026-01-01.
ssh_common_args
string
added in 3.2.0
ini entries:

[ssh_connection]
ssh_common_args = VALUE

env:ANSIBLE_SSH_COMMON_ARGS
var: ansible_ssh_common_args
Common extra arguments for all ssh CLI tools.
ProxyCommand is the only supported argument.
This option is deprecated in favor of proxy_command and will be removed in a release after 2026-01-01.
ssh_extra_args
string
added in 3.2.0
ini entries:

[ssh_connection]
ssh_extra_args = VALUE

env:ANSIBLE_SSH_EXTRA_ARGS
var: ansible_ssh_extra_args
Extra arguments exclusive to the 'ssh' CLI tool.
ProxyCommand is the only supported argument.
This option is deprecated in favor of proxy_command and will be removed in a release after 2026-01-01.
use_persistent_connections
boolean
Default:
"no"
ini entries:

[defaults]
use_persistent_connections = no

env:ANSIBLE_USE_PERSISTENT_CONNECTIONS
Toggles the use of persistence for connections

Authors

  • Ansible Networking Team (@ansible-network)

Hint

Configuration entries for each entry type 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.