ansible.netcommon.libssh connection – (Tech preview) Run tasks using libssh for ssh connection

Note

This connection plugin is part of the ansible.netcommon collection (version 3.0.1).

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 ansible.netcommon.

To use it in a playbook, specify: ansible.netcommon.libssh.

New in version 1.1.0: of ansible.netcommon

Synopsis

  • 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.

Parameters

Parameter

Comments

host_key_auto_add

boolean

TODO: write it

Choices:

  • no

  • yes

Configuration:

  • INI entry:

    [libssh_connection]
    host_key_auto_add = None
    
  • Environment variable: ANSIBLE_LIBSSH_HOST_KEY_AUTO_ADD

host_key_checking

boolean

Set this to “False” if you want to avoid host key checking by the underlying tools Ansible uses to connect to the host

Choices:

  • no

  • yes ← (default)

Configuration:

  • INI entries:

    [defaults]
    host_key_checking = yes
    
    [libssh_connection]
    host_key_checking = yes
    
  • Environment variable: ANSIBLE_HOST_KEY_CHECKING

  • Environment variable: ANSIBLE_SSH_HOST_KEY_CHECKING

  • Environment variable: ANSIBLE_LIBSSH_HOST_KEY_CHECKING

  • Variable: ansible_host_key_checking

  • Variable: ansible_ssh_host_key_checking

  • Variable: ansible_libssh_host_key_checking

look_for_keys

boolean

TODO: write it

Choices:

  • no

  • yes ← (default)

Configuration:

  • INI entry:

    [libssh_connection]
    look_for_keys = yes
    
  • Environment variable: ANSIBLE_LIBSSH_LOOK_FOR_KEYS

password

string

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.

Configuration:

  • Variable: ansible_password

  • Variable: ansible_ssh_pass

  • Variable: ansible_ssh_password

  • Variable: ansible_libssh_pass

  • Variable: ansible_libssh_password

proxy_command

string

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.

Default: “”

Configuration:

  • INI entry:

    [libssh_connection]
    proxy_command =
    
  • Environment variable: ANSIBLE_LIBSSH_PROXY_COMMAND

  • Variable: ansible_paramiko_proxy_command

  • Variable: ansible_libssh_proxy_command

pty

boolean

TODO: write it

Choices:

  • no

  • yes ← (default)

Configuration:

  • INI entry:

    [libssh_connection]
    pty = yes
    
  • Environment variable: ANSIBLE_LIBSSH_PTY

remote_addr

string

Address of the remote target

Default: “inventory_hostname”

Configuration:

  • Variable: inventory_hostname

  • Variable: ansible_host

  • Variable: ansible_ssh_host

  • Variable: ansible_libssh_host

remote_user

string

User to login/authenticate as

Can be set from the CLI via the --user or -u options.

Configuration:

  • INI entries:

    [defaults]
    remote_user = None
    
    [libssh_connection]
    remote_user = None
    
  • Environment variable: ANSIBLE_REMOTE_USER

  • Environment variable: ANSIBLE_LIBSSH_REMOTE_USER

  • Variable: ansible_user

  • Variable: ansible_ssh_user

  • Variable: ansible_libssh_user

use_persistent_connections

boolean

Toggles the use of persistence for connections

Choices:

  • no ← (default)

  • yes

Configuration:

  • INI entry:

    [defaults]
    use_persistent_connections = no
    
  • Environment variable: ANSIBLE_USE_PERSISTENT_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.