What I have done pre ansible right after I’ve installed vyos-1.5-rolling-202403050022-amd64.iso:
configure
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
commit
save
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:
group_vars/vyos_network.yml
ansible_python_interpreter: /usr/bin/python3
ansible_network_os: vyos
ansible_connection: network_cli
ansible_user: simone
inventory.yml
[vyos_network]
vyos.example.io
setup_vyos.yml
- name: setup the vyos router
hosts: vyos_network
gather_facts: false
tasks:
- name: Configure general settings for the vyos hosts group
vyos.vyos.vyos_config:
lines:
- set system name-server 9.9.9.9
- 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?