Configuration Management Tool

Ansible_user=UNREACHABLE {Failed to connect to the host via SSH: SSH: Could not resolve hostname (Name or service not known, unreachable true)

Ansible_user

The following message below has a lot of errors (dependencies) associated.

Error: ansible_user=administrator | UNREACHABLE! => {
"changed": false, "msg": "Failed to connect to the host via ssh: ssh: Could not resolve hostname ansible_user=administrator: Name or service not known",
"unreachable": true
UNREACHABLE

Note: The connection that is being initiated here is to a Windows machine.

SSH Connection Failure in Ansible

Solution: To resolve this error, please follow the following steps below
– Ensure the inventory file is configured properly and ensure that the “ansible_connection=winrm” is included in your inventory. Domain authentication requires using krb5. On how to configure kerberos, see the following article https://techdirectarchive.com/2020/03/14/configuring-kerberos-for-ansible-authentication/

[win]
192.168.178.43
[win:vars]
ansible_user=administrator
ansible_password=xxxxxxxxxxx
ansible_port = 5986
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore

When this is configured correctly, the following error will disappear.


– Configure the remote host system to connect with the Ansible Control node(SSH Connection Failure in Ansible). This will permit the connection between the Windows host system and the Ansible server.

For the differences between the NTLM and Kerberos, see the following article https://techdirectarchive.com/2020/04/11/active-directory-authentication-kerberos-and-ntlm/

For how a remote windows device is configured to support Ansible, see the following link https://techdirectarchive.com/2020/04/17/how-to-configure-a-remote-server-windows-to-support-ansible/

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x