[SOLVED] Ansible failing with no existing session

What I have done pre ansible right after I’ve installed vyos-1.5-rolling-202403050022-amd64.iso:

set interfaces ethernet eth0 address dhcp
set service ssh port '22'
set system login user simone full-name “Ansible Automation User”
set system login user simone authentication public-keys simone-automation-user key AAAAC3NzaC1lZDI1NTE5AAAAILDfmM5uM/a4jhltJkcQ/1mAfDCv4su1z5+zUG6eHIGL
set system login user simone authentication public-keys simone-automation-user type ssh-ed25519

So created the wan with dhcp so that I can get an ip of the box, enabled ssh, added the simone user with ssh-key auth.

SSH to the host with the simone is working I’ve tested it in my terminal. Below is my playbook:


ansible_python_interpreter: /usr/bin/python3
ansible_network_os: vyos
ansible_connection: network_cli
ansible_user: simone




- name: setup the vyos router
  hosts: vyos_network
  gather_facts: false
    - name: Configure general settings for the vyos hosts group
          - set system name-server
          - set interfaces ethernet eth0 description '#WAN#'
          - set interfaces ethernet eth1 description '#LAN#'
          - set system host-name {{ inventory_hostname }}
        save: true

result I get:

ansible-playbook setup_vyos.yml
[WARNING]: ansible-pylibssh not installed, falling back to paramiko
vyos.example.io | FAILED! => 
    changed: false
    msg: No existing session

here are my ansible version:

ansible [core 2.16.4]
  config file = /home/user/git/infra-local/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.12/site-packages/ansible
  ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.12.2 (main, Feb 21 2024, 00:00:00) [GCC 13.2.1 20231205 (Red Hat 13.2.1-6)] (/usr/bin/python3)
  jinja version = 3.1.3
  libyaml = True

here is the vyos collection version

ansible-galaxy collection list
vyos.vyos                                4.1.0  

So am I doing something wrong or I’ve found a bug?

the problem was that I really need ansible-pylibssh and not paramiko.
To install it you need sudo dnf install python3-devel python3-paramiko libssh-devel and with pip install ansible-pylibssh you install it at least on fedora.

1 Like

@lessfoobar thank you for sharing your solution! Your insight into installing ansible-ptlibssh instead of paramiko was incredibly valuable. Your solution will undoubtedly assist others who might encounter the same issue in the future. :pray:

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