Ansible 无法ping通的解决办法之一

  • Post author:
  • Post category:其他


明明配置IP正常,其他都没问题,目标机器就是无法通过ansible访问.

在这里插入图片描述

ansible k8s-node1 -m ping

[DEPRECATION WARNING]: [defaults]hostfile option, The key is misleading as it can also be a list of hosts, a directory or a list of paths , use [defaults]

inventory=/path/to/file|dir instead. This feature will be removed in version 2.8. Deprecation warnings can be disabled by setting deprecation_warnings=False in

ansible.cfg.

k8s-node1 | UNREACHABLE! => {


“changed”: false,

“msg”: “Failed to connect to the host via ssh: root@10.5.6.21: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).”,

“unreachable”: true

}

访问失败,

解决办法

ssh-copy-id root@k8s-node1

或 ssh-copy-id root@10.5.6.23

正常登陆一次,覆盖掉原来的ssh 信息,就正常了。

在这里插入图片描述



版权声明:本文为happyfreeangel原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。