我的~/.ssh/config文件干扰了 ansible,我在其中使用了很多缩写,以便在登录服务器时更轻松。
例如在:
Host te*
HostName %h.example.com
User test
Run Code Online (Sandbox Code Playgroud)
在我的 ansible hosts 文件中,我有:
[servers]
te1.exmaple.com
te2.example.com
Run Code Online (Sandbox Code Playgroud)
这意味着当我运行 ansible 时,连接将失败,因为它将使用我的 ssh 配置文件并尝试连接到te1.example.com.example.com.
我知道我可以将 ansible 主机修改为 te1 并让 ssh config 添加域的其余部分,但我知道我团队的其他成员没有像我一样设置他们的 .ssh/config 所以这不是真的一个选项,而 tbh 是一条简单的路线,最终会给其他人带来问题。
有没有办法告诉它不要使用我的或其他任何人的.ssh/config文件?