Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

New LibSSH connection plug-in for Ansible replaces Paramiko

February 13, 2026
Ganesh Nalawade
Related topics:
Automation and managementLinuxSecurity
Related products:
Red Hat Ansible Automation Platform

    As Red Hat Ansible Automation Platform expands its footprint with a growing customer base, security continues to be an important aspect of organizations' overall strategy. Red Hat regularly reviews and enhances the foundational codebase to follow better security practices. As part of this effort, we introduce the libssh connection plug-in that uses the libssh library. Red Hat Ansible Network Automation users can now achieve industrial scale performance while maintaining strict adherence to FIPS 140 readiness standards and fulfilling critical requirements for federal security compliance as outlined in DISA STIG ID: 1057.

    Network SSH connection basics

    Since most network appliances don't support or have limited capability for the local execution of a third-party software, the network modules are not copied to the remote host unlike Linux hosts. Instead, they run on the control node. Hence, the network can't use the typical Ansible SSH connection plug-in used with a Linux host. Due to this behavior, performance of the underlying SSH subsystem is critical (Figure 1). Not only does the new LibSSH connection plug-in enable FIPS readiness, but it is more performant than the existing Paramiko SSH subsystem.

    This diagram shows an Ansible Network Automation connection flow.
    Figure 1: This Ansible module execution model compares network devices and Linux/Windows hosts.

    The top level network_cli connection plug-in, provided by the ansible.netcommon collection, specifically the ansible.netcommon.network_cli, provides an SSH based connection to the network appliance. Then it calls the ansible.builtin.paramiko_ssh connection plug-in that depends on the Paramiko Python library to initialize the session between the control node and the remote host. After that, it creates a pseudo terminal (PTY) to send commands from the control node to the network appliance and receive the responses.

    Why replace Paramiko?

    The primary reason to replace the Paramiko library is that it doesn't guarantee FIPS readiness, and thus limits the Ansible Automation Platform network capability to run in environments that mandate FIPS mode enablement. Paramiko also isn't the speediest of connection plug-ins, so that can be enhanced. Therefore, you can now swap the new ansible.netcommon.libssh connection plug-in for Paramiko. The ansible.netcommon collection now contains this by default, and you can use it for testing purposes until the codebase becomes more stable (currently in Technology Preview).

    Comparing the connection flow to the previous flow, the top level network_cli connection plug-in that is provided by the ansible.netcommon collection, specifically the ansible.netcommon.network_cli still provides an SSH based connection to the network appliance. It in turn calls the ansible.netcommon.libssh connection plug-in that depends on the ansible-pylibssh Python library to initialize the session between control node and the remote host. This python library is essentially a Python wrapper on top of the libssh C library. It then creates pseudo terminals (PTY) over SSH using Python.

    Switching Ansible Playbooks to use LibSSH

    With the ansible.netcommon collection version 1.0.0, a new configuration parameter within ansible.netcommon.network_cli connection plug-in was added, which allows for you to set the ssh_type to either libssh or paramiko. 

    If the value of the configuration parameter is set to libssh, it will use the ansible.netcommon.libssh connection plug-in, which in turn uses the ansible-pylibssh Python library that supports FIPS readiness. If the value is set to paramiko, it will continue to use the default ansible.builtin.paramiko connection plug-in that relies on the paramiko Python library. 

    Again, the default value is set to paramiko, but in the future plans are to change the default to libssh.

    Installing and configuring LibSSH

    To utilize the LibSSH plug-in, you must first install the ansible-pylibssh Python library from PyPI using the following command:

    pip install ansible-pylibssh

    The current PyPI installation method bundles the correct version of libssh library and its dependencies as platform-specific wheels that don't rely on any OS-level libraries in runtime.

    Future plans include creation, publishing, and maintenance of stand-alone RPM and DEB packages for the ansible-pylibssh library that you can install with well-known Linux package managers. These will install the required system libssh version and its dependencies on the control node. Red Hat Enterprise Linux 8.1 and later contains the proper libssh package version and its dependencies.

    The current primary use case for using LibSSH with Ansible Automation Platform is for connecting to network devices. Connecting to other types of endpoints such as Linux will be officially enabled at a later date.

    How to use LibSSH in Ansible Playbooks

    There are two methods to using LibSSH in Ansible Playbooks.

    Method 1: You can set the ssh_type configuration parameter to use libssh in the active ansible.cfg file of your project as follows.

    [persistent_connection]
    ssh_type = libssh

    Method 2: Set the ANSIBLE_NETWORK_CLI_SSH_TYPE environment variable as follows.

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

    Note: This setting can be made at the individual task level, but only if the connection to the remote network device is not already established. That is, if the first task uses paramiko, then all subsequent tasks in the play must use paramiko even if libssh is specified in any subsequent tasks.

    Troubleshooting LibSSH connections

    To quickly verify the libssh transport is set correctly, you can run the following playbook using the ansible-playbook command line with the verbose flag -vvvv. Before running, ensure the inventory file is set correctly.

    This example playbook uses the cisco.ios collection and must first be installed from Ansible Galaxy or Ansible Automation Platform on your control node.

    - 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 interface command
        ansible.netcommon.cli_command:
           command: show interfaces

    https://gist.github.com/ganeshrn/78149adca85c809b69ed1b5f5262844c

    In the output verbose logs, you should see the line "ssh type is set to libssh" displayed on the console, which confirms the configuration is set correctly.

    Next steps

    Start testing your Ansible Playbooks by setting the configuration to use the ansible-pylibssh library. Help with performance profiling of your existing playbook of ansible-pylibssh library with respect to paramiko library. Get involved with the ansible-pylibssh project.

    Last updated: February 23, 2026

    Related Posts

    • Multi-homed inventory management with Ansible Automation Platform

    • What's new in Ansible Automation Platform 2.6

    • Multicluster authentication with Ansible Automation Platform

    • Protecting virtual machines from storage and secondary network node failures

    Recent Posts

    • Introducing virtualization platform autopilot

    • Integrate zero trust workload identity manager with Red Hat OpenShift GitOps

    • Best Practice Configuration and Tuning for Linux and Windows VMs

    • Red Hat UBI 8 builders have been promoted to the Paketo Buildpacks organization

    • Using eBPF in Red Hat products

    What’s up next?

    SSH into remote machines

    SSH into remote machines using Ansible cheat sheet

    Deepankar Jain
    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility