無法到達! => {"changed": false, "msg": "資料無法傳送到遠端主機

無法到達! => {"changed": false, "msg": "資料無法傳送到遠端主機

我可以透過 SSH 存取特定伺服器,但是當我嘗試為該伺服器執行 playbook 時。我正在嘗試為該伺服器進行部署,但遇到了問題。

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 確實不希望您自動輸入密碼。

相關內容