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.

Query Netbox with Ansible to generate an Ansible inventory

Make sure you use Ansible version >= 2.10.x
pip3 install –user –upgrade pip
pip3 install –user –upgrade ansible

Install pynetbox
apt install python3-pip
pip install pynetbox –upgrade

Install the Ansible module
ansible-galaxy collection install netbox.netbox

Simple netbox-inventory YAML
# 02-netbox-inventory.yml

plugin: netbox.netbox.nb_inventory
api_endpoint: https://netbox.heaven.grp
token: api-key
validate_certs: false
config_context: false
  – tags

Install Netbox
Follow the Netbox installation guide
Fill in some live in there

Testing the generation of the Netbox inventory via ansible-inventory
ansible-inventory -i 02-netbox-inventory.yml –list