【发布时间】:2016-03-29 02:57:24
【问题描述】:
我正在 openstack (linux vm) 中创建一个 vm 并从那里启动 ansible 脚本。我收到以下 ssh 错误。
---
- hosts: licproxy
user: my-user
sudo: yes
tasks:
- name: Install tinyproxy#
command: sudo apt-get install tinyproxy
- name: Update tinyproxy
command: sudo apt-get update
- name: Install bind9
shell: yes '' | sudo apt-get install bind9
虽然我可以直接从 openstack admin-keydev29 中的 linux 框 ssh 到机器 10.32.1.40
PLAY [licproxy] ***********************************************************
GATHERING FACTS ***************************************************************
<10.32.1.40> ESTABLISH CONNECTION FOR USER: my-user
<10.32.1.40> REMOTE_MODULE setup
<10.32.1.40> EXEC ssh -C -tt -vvv -o StrictHostKeyChecking=no -o IdentityFile="/opt/apps/installer/tenant-dev29/ssh/admin-key-dev29" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=my-user -o ConnectTimeout=10 10.32.1.40 /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1450797442.33-90087292637238 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1450797442.33-90087292637238 && echo $HOME/.ansible/tmp/ansible-tmp-1450797442.33-90087292637238'
EXEC previous known host file not found for 10.32.1.40
fatal: [10.32.1.40] => SSH Error: ssh: connect to host 10.32.1.40 port 22: Connection refused
while connecting to 10.32.1.40:22
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
TASK: [Install tinyproxy] *****************************************************
FATAL: no hosts matched or all hosts have already failed -- aborting
我从 known_host 条目中删除并再次运行脚本,它仍然显示相同的消息。
更新
我观察到手动 ssh 工作正常。但是 ansible 脚本给出了 ssh 错误。 我使用 ssh 密钥登录到新创建的虚拟机并检查 /var/log/auth.log 文件
Dec 30 13:00:33 licproxy-vm sshd[1184]: Server listening on :: port 22.
Dec 30 13:01:10 licproxy-vm sshd[1448]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Dec 30 13:01:10 licproxy-vm sshd[1448]: Connection closed by 192.168.0.106 [preauth]
Dec 30 13:01:32 licproxy-vm sshd[1450]: error: Could not load host key: /etc/ssh/ssh_host_ed25519_key
vm有sshd版本OpenSSH_6.6.1版本 我检查了 /etc/ssh 文件夹,发现 ssh_host_ed25519_key 和 ssh_host_ed25519_key.pub 丢失
我使用命令 ssh-keygen -A 创建了这些文件。
现在我想知道为什么 ssh 文件夹中缺少这些文件。这是一个错误吗?
【问题讨论】:
-
服务器上的IP白名单可能吗?
-
@eugecm...那是什么?
-
你能直接从你正在使用 ansible 的机器上连接吗?
-
@eugecm 是的,我可以连接
-
您可以在命令中添加 -vvvv 并在问题上发布输出吗?
标签: ssh ubuntu-14.04 ansible ansible-playbook ssh-keys