ansible Failed to connect to the host via ssh: no such identity: /root/.ssh/id_rsa.bak

Posted bccd

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ansible Failed to connect to the host via ssh: no such identity: /root/.ssh/id_rsa.bak相关的知识,希望对你有一定的参考价值。

中控机和远端主机配置完密钥后,在中控台上通过ansible检测联通性

ansible -i inventory.cfg all -m ping
10.1.1.1 | UNREACHABLE! => {
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: no such identity: /root/.ssh/id_rsa.bak: No such file or directory
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
", 
    "unreachable": true
}

通过调试选项查看

ansible -vvv -i inventory.cfg all -m ping 
ansible 2.6.2
  config file = /home/bichenchen001/mongodb_auto_deploy/ansible.cfg
  configured module search path = [u/root/.ansible/plugins/modules, u/usr/share/ansible/plugins/modules]
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, Apr 11 2018, 07:36:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Using /home/bichenchen001/mongodb_auto_deploy/ansible.cfg as config file
Parsed /home/bichenchen001/mongodb_auto_deploy/inventory.cfg inventory source with ini plugin
META: ran handlers
<10.1.1.1> ESTABLISH SSH CONNECTION FOR USER: None
<10.1.1.1> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o IdentityFile="/root/.ssh/id_rsa.bak" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o 

发现会指定 /root/.ssh/id_rsa.bak  手动创建文件解决问题

cp /root/.ssh/id_rsa /root/.ssh/id_rsa.bak

 

 

以上是关于ansible Failed to connect to the host via ssh: no such identity: /root/.ssh/id_rsa.bak的主要内容,如果未能解决你的问题,请参考以下文章

android 中Network error IOException: failed to connect to /127.0.0.1 (port 1433): connect failed: ECO

GlideException: Failed to load resource……java.net.SocketTimeoutException(failed to connect to xxx)

GlideException: Failed to load resource……java.net.SocketTimeoutException(failed to connect to xxx)

git使用Failed to connect to 127.0.0.1 port 1080: Connection refused

failed to connect to gitee.com port 443: timed out

如何解决esri_sde, Connection to RDBMS failed.