i know the username and private key are good as i use them to connect to the same target in a terminal emulator. i am not able to get this working with ansible though.
- name: get show run
ansible.netcommon.cli_command:
command: "show running-config"
register: results
and finally the output. its actually crying about a public key but i don’t’ understand that and haven’t had any luck in my internet searching.
this is probably simple but i’m a network guy, not a linux guy
TASK [get show run] ***********************************************************************************************************************************************************************
task path: /home/brian.goulet/ISE-test.yml:46
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
The full traceback is:
File "/home/brian.goulet/.ansible/collections/ansible_collections/ansible/netcommon/plugins/modules/cli_command.py", line 171, in main
response = connection.get(**module.params)
File "/opt/ansible/venv/ansible8.0/lib64/python3.9/site-packages/ansible/module_utils/connection.py", line 200, in __rpc__
raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [10.22.5.240]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"answer": null,
"check_all": false,
"command": "show running-config",
"newline": true,
"prompt": null,
"sendonly": false
}
}
}
MSG:
ssh connection failed: Failed to authenticate public key: Access denied for 'publickey'. Authentication that can continue: publickey
I’m having the same issue here. I had mine working a few days ago, but due to (other circumstances) I had to rebuild and now everything I had configured stopped working.
during testing i found i was not able to dirrect ssh to anything from the linux box, even hosts ansible could connect to. my linux sysadmin fixed something in the background. i have no details on the fix
after item 1 was resolved it was discovered the username being used was incorrect. big fat human error
in the course of researching, i did also find this. it ended up not being my issue but i’ll leave it here for anyone else stumbling on this post that might be running older packages. the bug submission and fix was nearly 4 years ago.