在localhost中Ansible SSH ERROR连接

时间:2016-05-12 10:48:57

标签: ssh ansible ansible-playbook

当我针对localhost主机启动我的playbook时出现此错误。

TASK [setup] *******************************************************************
fatal: [127.0.0.1]: UNREACHABLE! => {"changed": false, "msg": "SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue", "unreachable": true}
to retry, use: --limit @deploy-test-env.retry

PLAY RECAP *********************************************************************
127.0.0.1                  : ok=0    changed=0    unreachable=1    failed=0

我的hosts文件有这个配置:

[local]
127.0.0.1

有什么问题?

谢谢!

2 个答案:

答案 0 :(得分:0)

对我有用的不包括清单中的localhost,只在hosts模式中指定它。

即。 hosts:localhost

这似乎意味着与ansible的本地连接

答案 1 :(得分:0)

可以更轻松地完成操作。

ansible.cfg 文件的 [默认值] 部分下,只需粘贴以下行:

transport = local