Nikhil Araga
Nikhil Araga

Reputation: 21

Ansible "Could not resolve hostname" error for host user@ip_address

while running this...

$ ansible all -m ping

I am getting this...

[WARNING]: sftp transfer mechanism failed on [[email protected]]. Use ANSIBLE_DEBUG=1 to see detailed information
[WARNING]: scp transfer mechanism failed on [[email protected]]. Use ANSIBLE_DEBUG=1 to see detailed information

[email protected] | FAILED! => {
  "failed": true,
  "msg": "failed to transfer file to /home/test/.ansible/tmp/ansible-tmp-148610479.7-240708330710714/ping.py:\n\nssh: Could not resolve hostname 172.31.48.154]:Name or service not known\r\nlost connection\n"
}
localhost | SUCCESS => {
  "changed": false,
  "ping": "pong"
}

Upvotes: 2

Views: 7373

Answers (1)

Grisha Levit
Grisha Levit

Reputation: 8617

Using username@host is not supported in the inventory. See issue #14255.

Instead, you can write your inventory file like:

host.example.com     ansible_connection=ssh        ansible_user=test

Or run your command like:

$ ansible all -m ping -u test

Upvotes: 5

Related Questions