搜索
您的当前位置:首页正文

“Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,pa

来源:步旅网

用ansible执行yml文件时候,出现下面的报错:

TASK [Gathering Facts] **************************************************************************************************
fatal: [192.168.1.20]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n", "unreachable": true}
	to retry, use: --limit @/root/disk_partition/deploy-disk.retry

解决方法:
要做免密。如果ansible主机安装在其中一台生产环境中,那也要自己和自己做免密。

ssh-keygen
一路回车生成密钥(在/root/.ssh中生成密钥对)
ssh-copy-id 用户@ip
//把公钥发给要做免密的主机

验证一下:

ssh 用户@ip 
//不需要密码访问

因篇幅问题不能全部显示,请点此查看更多更全内容

Top