0
我剛剛創建了一個用於啓動EC2實例的劇本,我的原始圖像是ami-63b25203
,並且所有內容都正常運行,但是當我將此圖像更改爲ami-9abea4fb
時。我得到這個錯誤Ansible在連接到AWS時失敗
fatal: [ec2-52-34-133-13.us-west-2.compute.amazonaws.com] => SSH Error: Permission denied (publickey).
while connecting to 52.34.133.13:22
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
TASK: [Jenkins | Add Jenkins repository] **************************************
FATAL: no hosts matched or all hosts have already failed -- aborting
和,這是我在github劇本:https://github.com/hly189/Ansible/blob/master/ec2.yml
和,這是我ansible.cfg配置
[defaults]
#ask_sudo_pass = True
host_key_checking = False
remote_user = ec2-user
[ssh_connection]
control_path = "%(directory)s/%%h-%%r"
ssh_args = -o ForwardAgent=yes
誰能告訴我如何修復這個錯誤?
實際上,通過將'remote_user'更改爲'user'來修復。順便說一句,請你解釋一下爲什麼,因爲當我在Amazon Linux中使用'remote_user'時,這是不同的ami,這仍然是正常的 – Alexander
什麼是你的可靠版本? –
我的支持版本是1.9.3 – Alexander