Netcommon.cli_command using ssh keys

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.

here are the vars from my host file

vars:
    ansible_user: "admin"
    ansible_private_key_file: "filename.pem"
    ansible_become: false
    ansible_host_key_checking: false
    ansible_connection: network_cli
    ansible_network_os: cisco.ios.ios

and one simple task

  - 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

nobody knows what the issue is here?

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.

my issue is resolved

  1. 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
  2. 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.