Problem with login to EdgeOS device

Prerequities so far:
ansible-galaxy collection install
pip3 install paramiko

I had trouble to properly connect to an EdgeOS device with Ansible and the module.

First I tried to send authetication data with ansible_ssh_user and a vaulted password via ansible_ssh_password.

This left me with the error:
fatal: [edgerouter.heaven.grp]: FAILED! => {
„changed“: false,
„module_stderr“: „Expected unicode or bytes, got {‚__ansible_vault‘: ‚$ANSIBLE_VAULT;1.1;AES256…

I tried to replace the paramiko python module with
pip3 install ansible-pylibssh

This also did not work with the encrypted vault password variable.

So I tried to setup SSH login via ssh key.

For this you have to add your public key to the EdgeOS devicset system login set system login user ubnt authentication public-keys <keyid> type ssh-rsa
set system login user ubnt authentication public-keys <keyid> key  <publickey>

So passwordless login was possible from normal Ubuntu OS via SSH but login via Ansible was still not possible:
redirecting (type: modules) to
fatal: [edgerouter.heaven.grp]: FAILED! => {
„changed“: false,
„module_stderr“: „ssh connection failed: Failed to authenticate public key: Access denied for ‚publickey‘. Authentication that can continue: publickey,password“,
„module_stdout“: „“,
„msg“: „MODULE FAILURE\nSee stdout/stderr for the exact error“

I found a bug that describes this problem in

Replacing the file here ~/.ansible/collections/ansible_collections/ansible/netcommon/plugins/connection/ with the file from the above commit solved the problem.