The connection plugin 'libssh' was not found

Im trying to work with ansible-libssh instead of paramiko because with paramiko i have alot of issues of disconnection of ssh, so i wanted to try libssh
but i was not able to use it as i get the error
the connection plugin 'libssh' was not found when runing a playbook.

ansible --version

ansible [core 2.17.2]
  config file = /Users/batchenr/ansible.cfg
  configured module search path = ['/Users/batchenr/venv/lib/python3.10/site-packages/ansible/modules']
  ansible python module location = /Users/batchenr/venv/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/batchenr/venv/lib/python3.10/site-packages/ansible_collections
  executable location = /Users/batchenr/venv/bin/ansible
  python version = 3.10.8 (v3.10.8:aaaf517424, Oct 11 2022, 10:14:40) [Clang 13.0.0 (clang-1300.0.29.30)] (/Users/batchenr/venv/bin/python)
  jinja version = 3.1.2
  libyaml = True

my settings:

  • inventory file :
 [servers:vars]
ansible_user=user
ansible_ssh_private_key_file=~/.ssh/id_rsa.user.user
ansible_ssh_retries=3
ansible_connection=libssh

 [servers]
ansible_host= x.x.x.x
ansible_become_pass= xxx

ansible.cfg:

[defaults]
transport = libssh

[libssh_connection]
ssh_type = libssh
host_key_auto_add = False
ssh_args = -C -o ControlMaster=auto -o ControlPersist=600s
control_path = /dev/shm/cp%%h-%%p-%%r
timeout = 1600
pipelining = True

[persistent_connection]
ssh_type = libssh
command_timeout=1200
connect_timeout=600

ansible-galaxy collection list
ansible.netcommon 6.1.3

pip freeze | grep ansible

ansible==10.2.0
ansible-core==2.17.2
ansible-pylibssh==1.2.2

im runing on Macos with venv
also i have made sure libssh is installed:

brew install libssh
libssh 0.10.6 is already installed and up-to-date.
What am i missing?

The connection plugin is called ansible.netcommon.libssh, not simply libssh. (Short names only exist for plugins/modules that already were part of Ansible 2.9. The libssh connection plugin was added to ansible.netcommon 1.1.0, and thus was not moved there from Ansible 2.9.)

Try ansible_connection=ansible.netcommon.libssh.

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.