ansible无法连接到centos

ansible无法连接到centos,ansible,Ansible,当我尝试连接到CentOS服务器时,出现以下错误 boby@hon-pc-01:~/www/ansible $ ansible centos -vvv -i hosts -a "uname -a" Using /home/boby/www/ansible/ansible.cfg as config file <root@209.236.74.192:3333> ESTABLISH SSH CONNECTION FOR USER: root <root@209.236.74.19

当我尝试连接到CentOS服务器时,出现以下错误

boby@hon-pc-01:~/www/ansible $ ansible centos -vvv -i hosts -a "uname -a"
Using /home/boby/www/ansible/ansible.cfg as config file
<root@209.236.74.192:3333> ESTABLISH SSH CONNECTION FOR USER: root
<root@209.236.74.192:3333> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/boby/.ansible/cp/ansible-ssh-%h-%p-%r -tt root@209.236.74.192:3333 'mkdir -p "$( echo $HOME/.ansible/tmp/ansible-tmp-1484629049.5-55764328572466 )" && echo "$( echo $HOME/.ansible/tmp/ansible-tmp-1484629049.5-55764328572466 )"'
root@209.236.74.192:3333 | UNREACHABLE! => {
    "changed": false, 
    "msg": "ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue", 
    "unreachable": true
}
boby@hon-pc-01:~/www/ansible $
你知道为什么CentOS 6服务器不能工作吗

编辑


我把它修好了。问题出在hosts文件中的root@上。由于某些原因,SSH命令没有使用端口3333,因为主机文件中存在root@present。

问题出在主机文件中

boby@hon-pc-01:~/www/ansible $ cat hosts
[ubuntu]
vm705n:3333

[centos]
root@209.236.74.192:3333
boby@hon-pc-01:~/www/ansible $ 

取代root@209.236.74.192:3333和209.236.74.192:3333,它开始工作

感谢您的回复,我可以在Centos服务器上连接到ssh。boby@hon-pc-01:~$ssh-p3333root@209.236.74.192上次登录:2017年1月17日星期二06:10:02,从59.98.136.13开始root@server2[~]#与209.236.74.192的注销连接已关闭。boby@hon-pc-01:~$I已修复,问题是ansible生成的第一个ssh命令中缺少-o Port=3333。我从主机文件中删除了root@(用户名部分),它开始正常工作。
boby@hon-pc-01:~/www/ansible $ cat hosts
[ubuntu]
vm705n:3333

[centos]
root@209.236.74.192:3333
boby@hon-pc-01:~/www/ansible $ 
boby@hon-pc-01:~/www/ansible $ cat hosts
[ubuntu]
vm705n:3333

[centos]
root@209.236.74.192:3333
boby@hon-pc-01:~/www/ansible $