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

In this article, you will learn how to resolve “Ansible_user=UNREACHABLE {Failed to connect to the host via SSH: SSH: Could not resolve hostname (Name or service not known, unreachable true)”. Please see How to install and configure Ansible on Ubuntu, and Associate SSH Public key with Azure Linux VM. 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

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

Also, see how to Install and configure Ansible on Azure Virtual Machine, and how to fix “Ansible error: Server unreachable, ssl: auth method ssl requires a password“.

Solution to SSH Connection Failure in Ansible

To resolve this error, please follow the following steps. 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.

[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.

I hope you found this article useful in resolving the following error “Ansible_user=UNREACHABLE {Failed to connect to the host via SSH: SSH: Could not resolve hostname (Name or service not known, unreachable true)”.

Subscribe
Notify of
guest

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