主机用户@ ip_address的Ansible“无法解析主机名”错误

时间:2017-02-03 07:34:41

标签: ssh ansible

在运行时......

$ ansible all -m ping

我得到了这个......

[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"
}

1 个答案:

答案 0 :(得分:4)

广告资源不支持使用username@host。请参阅问题#14255

相反,您可以编写库存文件,如:

host.example.com     ansible_connection=ssh        ansible_user=test

或运行您的命令,如:

$ ansible all -m ping -u test