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\r\nPermission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n",
"unreachable": true
}

通过调试选项查看

ansible -vvv -i inventory.cfg all -m ping
ansible 2.6.
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./site-packages/ansible
executable location = /bin/ansible
python version = 2.7. (default, Apr , ::) [GCC 4.8. (Red Hat 4.8.-)]
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= -o

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

cp /root/.ssh/id_rsa /root/.ssh/id_rsa.bak
 
上一篇:Django:视图views(一)


下一篇:[Microsoft][ODBC Microsoft Access Driver] 参数不足,期待是 1