New LibSSH Connection Plugin for Ansible Network Replaces Paramiko, Adds FIPS Mode Enablement
Switching Ansible Playbooks to use LibSSH
# Installing LibSSH
pip install ansible-pylibssh
Using LibSSH in Ansible Playbooks
Method 1. The ssh_type configuration parameter can be set to use libssh in the active ansible.cfg file of your project
[persistent_connection]
ssh_type = libssh
Method 2: Set the ANSIBLE_NETWORK_CLI_SSH_TYPE environment variable
$ export ANSIBLE_NETWORK_CLI_SSH_TYPE=libssh
Method 3: Set the ansible_network_cli_ssh_type parameter to libssh within your playbook at the play level
Playbook to test libssh configuration settings
- hosts: "changeme"
gather_facts: no
connection: ansible.netcommon.network_cli
vars:
ansible_network_os: cisco.ios.ios
ansible_user: "changeme"
ansible_password: "changeme"
ansible_network_cli_ssh_type: libssh
tasks:
- name: run show version command
ansible.netcommon.cli_command:
command: show version
- name: run show version command
ansible.netcommon.cli_command:
command: show interfaces
