Prerequities so far:
ansible-galaxy collection install community.network
pip3 install paramiko
I had trouble to properly connect to an EdgeOS device with Ansible and the community.network.edgeos_config 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 libssh.py:
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) community.network.edgeos_config to community.network.network.edgeos.edgeos_config
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
https://github.com/ganeshrn/netcommon/blob/08c7e0f32655e99659dfac25870f470de43ae8f7/plugins/connection/libssh.py
Replacing the file here ~/.ansible/collections/ansible_collections/ansible/netcommon/plugins/connection/libssh.py with the file from the above commit solved the problem.