我有特定服务器的 SSH 访问权限,但当我尝试运行该服务器的剧本时。我尝试为该服务器进行部署,但遇到了问题。
fatal: [lapp999.corp.com]]: UNREACHABLE! => {"changed": false, "msg": "Data could not be sent to remote host \"lapp999.corp.com\". Make sure this host can be reached over ssh: ********************************************************************************\n
!!!WARNING!!!\n********************************************************************************\nThis system is a restricted access system. All activity on this system is\nsubject to monitoring. Information collected that is malicious, unauthorized or\nunlawful, may be provided to the relevant authorities for further action. By\ncontinuing past this point, you expressly consent to this monitoring.\n********************************************************************************\
[email protected]: Permission denied (publickey).\r\n", "unreachable": true}
有人可以帮忙修复这个问题吗?
答案1
ansible-playbook -vvv
Verbosity 3 开始打印运行的命令,包括 ssh 命令行。将其与您声称以交互方式工作的 ssh 命令进行比较。
检查是否IdentityFile
应该为此主机设置ssh_config
,如果是,则设置哪个凭证。
Ansible 默认不使用交互式 ssh 选项。如果您需要密码,则需要通过--ask-pass
命令行提供密码,或者设置变量ansible_password
并安装该sshpass
程序,因为 OpenSSH 确实不希望您自动输入密码。