简体   繁体   中英

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 [test@172.31.48.154]. Use ANSIBLE_DEBUG=1 to see detailed information
[WARNING]: scp transfer mechanism failed on [test@172.31.48.154]. Use ANSIBLE_DEBUG=1 to see detailed information

test@172.31.48.154 | 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"
}

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM