04-25-2020 06:53 PM
PLAY [sandbox-iosxe-latest] *********************************************************************************************************************************
TASK [facts] ************************************************************************************************************************************************
fatal: [sandbox-iosxe-latest]: FAILED! => {"changed": false, "msg": "paramiko: The authenticity of host '[ios-xe-mgmt-latest.cisco.com]:8181' can't be established.\nThe ssh-rsa key fingerprint is b7e974a8cbf96d464f7be3e12a86d265."}
PLAY RECAP **************************************************************************************************************************************************
sandbox-iosxe-latest : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
i am getting the above error
04-25-2020 07:38 PM
Have you successfully established an ssh connection to the sandbox device outside of Ansible?
04-26-2020 05:08 AM
The Ansible is not printing the full message there. The full message is something like this:
The authenticity of host '<HOSTNAME IP>' can't be established.
RSA key fingerprint is XX:XX:XX:XX........XX:XX .
Are you sure you want to continue connecting (yes/no)?
This is an expected message when you first try to ssh to a device. It simply says this device has this IP and this fingerprint. Are you sure you want to connect to it?
As @Claudia de Luna mentioned, try first an SSH to ios-xe-mgmt-latest.cisco.com using a local SSH client, on the same machine where you run your Ansible playbooks. You will be asked if you are sure you want to continue. Type yes and then continue with your Ansible.
Cheers,
Sergiu
04-26-2020 06:02 AM - edited 04-26-2020 06:03 AM
for test environment ..
you add following in ansible.cfg:
[defaults] host_key_checking = False
If you don't want to modify ansible.cfg you can set an environment variable:
export ANSIBLE_HOST_KEY_CHECKING=False
hope this helps
09-07-2023 08:08 AM - edited 09-07-2023 09:23 AM
Hi,
I was stuck in similar problem. I did not want to disable the host key checking and instead added the following to ansible.cfg and the problem got solved:
INI entry:
[paramiko_connection] host_key_auto_add = True
Environment variable: ANSIBLE_PARAMIKO_HOST_KEY_AUTO_ADD=True
And yes I tried to manually ssh to the device and accept the hostkey but it did not work in our environment till I added the above config.
/M
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide