Ansible不';无法连接到服务器-连接超时

Ansible不';无法连接到服务器-连接超时,ansible,Ansible,我尝试使用ansible连接到服务器。我已经用openssh安装了ubuntu服务器。我在服务器上添加公钥,当我尝试使用ssh连接到服务器时,它可以工作: ssh ubuntu@92.168.0.14 因此,我创建了ansible清单文件hosts [dbservers] 192.16.0.14 ansible_ssh_port=22 ansible_ssh_user=ubuntu 接下来我尝试运行命令: ansible all -i hosts -m ping -vvvv 但当我运行它时

我尝试使用ansible连接到服务器。我已经用openssh安装了ubuntu服务器。我在服务器上添加公钥,当我尝试使用ssh连接到服务器时,它可以工作:

ssh ubuntu@92.168.0.14
因此,我创建了ansible清单文件
hosts

[dbservers]
192.16.0.14 ansible_ssh_port=22 ansible_ssh_user=ubuntu
接下来我尝试运行命令:

ansible all -i hosts -m ping -vvvv
但当我运行它时,我得到一个错误:

<192.16.0.14> ESTABLISH CONNECTION FOR USER: ubuntu
<192.16.0.14> REMOTE_MODULE ping
<192.16.0.14> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/karol/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'Port=22', '-o', 'IdentityFile=/home/karol/.ssh/id_rsa', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=ubuntu', '-o', 'ConnectTimeout=10', '192.16.0.14', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1431369235.84-48071922815331 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1431369235.84-48071922815331 && echo $HOME/.ansible/tmp/ansible-tmp-1431369235.84-48071922815331'"]
192.16.0.14 | FAILED => SSH encountered an unknown error. The output was:
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: auto-mux: Trying existing master
debug1: Control socket "/home/karol/.ansible/cp/ansible-ssh-192.16.0.14-22-ubuntu" does not exist
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.16.0.14 [192.16.0.14] port 22.
debug2: fd 3 setting O_NONBLOCK
debug1: connect to address 192.16.0.14 port 22: Connection timed out
ssh: connect to host 192.16.0.14 port 22: Connection timed out
为用户建立连接:ubuntu
远程模块ping
执行官['ssh'、'-C'、'-tt'、'-vvv'、'-o'、'ControlMaster=auto'、'-o'、'ControlPersist=60s'、'-o'、'ControlPath=/home/karol/.ansible/cp/ansible-ssh-%p-%r'、'-o'、'Port=22'、'-o'、'IdentityFile=/home/karol/.ssh/id\u rsa'、'-o'、'KbdInteractiveAuthentication=no'、'o'、'PreferredAuthentications=gssapi-mic、gsi-keyex、'wordAuthentication=no'、'-o'、'User=ubuntu'、'-o'、'ConnectTimeout=10'、'192.16.0.14'、“/bin/sh-c'mkdir-p$HOME/.ansible/tmp/ansible-tmp-1431369235.84-48071922815331&&chmod a+rx$HOME/.ansible/tmp/ansible/48071922815335.84-48071922815331&&echo$HOME/.ansible/tmp/ansible-tmp/ansible-tmp-1431369235.84-48071922815331&&480712331]
192.16.0.14 | FAILED=>SSH遇到未知错误。输出为:
OpenSSH_6.6.1、OpenSSL 1.0.1f 2014年1月6日
debug1:读取配置数据/etc/ssh/ssh\u config
debug1:/etc/ssh/ssh\u配置第19行:应用*
debug1:自动多路复用器:尝试现有主机
debug1:控制套接字“/home/karol/.ansible/cp/ansible-ssh-192.16.0.14-22-ubuntu”不存在
debug2:ssh\u connect:needpriv 0
debug1:连接到192.16.0.14[192.16.0.14]端口22。
调试2:fd 3设置O_非块
debug1:连接到地址192.16.0.14端口22:连接超时
ssh:连接到主机192.16.0.14端口22:连接超时

我使用相同的身份文件,所以为什么ansible无法连接到服务器?

也许,问题在于:

ubuntu@**92.168.0.14**

[dbservers]
**192.16**.0.14 ansible_ssh_port=22 ansible_ssh_user=ubuntu
以下是具有不同fors八位字节的不同ip地址:
92.168和192.16

您的手动ssh行是用于
92.168.xx.yy
,而Ansible行是用于
192.68.xx.yy
。您也有一些
192.16.0.14
。可能是您想整理一下
192.16.0.14
vs
92.168.0.14
vs
192.168.0.14
rch问题在错误的地方。谢谢。