我有9個服務器,我試圖安裝一個使用ansible的軟件包,我能夠使用密碼ssh進入5臺服務器,而其他的4在ssh'ng進入時不會詢問任何密碼。Ansible:如何解決「sudo:需要密碼」錯誤?
但是我已將id_rsa.pub鍵複製到所有9臺服務器。
現在有用的腳本對5個服務器正常工作,但剩餘4個4我收到以下錯誤消息。
fatal: [xxx0?]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Connection to xxx0? closed.\r\n", "module_stdout": "sudo: a password is required\r\n", "msg": "MODULE FAILURE", "rc": 1}
我Ansible.cfg
[defaults]
filter_plugins =./filter_plugins
roles_path = ./roles
sudo_user = root
host_key_checking = False
retry_files_enabled = False
password = ~/password.txt
timeout = 25
[ssh_connection]
ssh_args = -F ~/.ssh/config -o ControlMaster=no -o ControlPersist=30m
control_path = ~/.ssh/ansible-%%[email protected]%%h:%%p
的〜/ .ssh/config中
Host xx0? xx0? xx0? xx0? xx0? xx0? xx0? xx0? xx0? .xyz.com
User yyy
Port 22
ansible版本= ansible 2.3.1.0
我怎樣才能解決這個問題?
也許您在4臺服務器上的.pub文件上存在權限錯誤,這些服務器出現故障。 – Difster
我在哪裏可以看到.pub文件? – Swat
它位於您複製到的目錄中。我無法知道這一點。 另外,對於其他評論感到抱歉,這是意味着另一個問題。它已被刪除。 – Difster