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