我正在尝试使用以下命令 ping 我的远程linux机器:
ansible remote -m ping -vvvv
我收到以下回复:
[root@ansible ansible]# ansible remote -m ping -vvvv
Using /etc/ansible/ansible.cfg as config file
Loaded callback minimal of type stdout, v2.0
<192.41.50.9> ESTABLISH SSH CONNECTION FOR USER: root
<192.41.50.9> SSH: EXEC sshpass -d12 ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o User=root -o ConnectTimeout=10 -o ControlPath=/root/.ansible/cp/ansible-ssh-%h-%p-%r 192.41.50.9 '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1480431200.39-212981181831507 `" && echo ansible-tmp-1480431200.39-212981181831507="` echo $HOME/.ansible/tmp/ansible-tmp-1480431200.39-212981181831507 `" ) && sleep 0'"'"''
192.41.50.9 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh.",
"unreachable": true
}
我的 主机文件 如下所示:
[remote]
192.41.50.9
[remote:vars]
ansible_ssh_user=root
ansible_ssh_pass=p@ssw0rd
ansible_ssh_port=22
当我尝试ssh到我的远程机器时,这就是我得到的:
[root@ansible ansible]# ssh root@192.41.50.9
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
86:d2:ca:8e:aa:8a:ce:25:c7:e5:31:7e:2a:c0:11:7f.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending RSA key in /root/.ssh/known_hosts:3
RSA host key for 192.41.50.9 has changed and you have requested strict checking.
Host key verification failed.
连接失败 的原因可能是什么?
答案 0 :(得分:0)
如果您阅读了shell ssh的输出,那么您将找到
如果您的案例是后者,您可以在ansible配置文件中添加以下部分[defaults]
host_key_checking=False
INSERT INTO OPENROWSET('MICROSOFT.ACE.OLEDB.12.0', 'EXCEL
12.0;DATABASE=D:\DOWNLOADS\XLFILE.XLSX;', 'SELECT COLUMNNAMES FROM [HT$]')
SELECT COLUMNNAMES
FROM [DBRD].[DBO].[TABLE]
答案 1 :(得分:0)
我没有足够的声誉来发表评论或赞成,但用户2599522有你的答案,或至少其中一个。
假设您正在使用root并始终尝试192.41.50.9主机,请运行:
SELECT Package_Code,
Description,
Duration,
Site_Code
FROM tbl_Holiday_Details
INNER JOIN tbl_Site_Visted
USING( Package_Code )
INNER JOIN tbl_Site_Visted
USING( Site_Code )
这将删除以前的指纹,让您接受新指纹。 原因正是他所说的。
此外,他的解决方案是永久性的。使用它有利于开发,因为它始终适用。我建议的那个会工作一次,直到你再次更换主机。
答案 2 :(得分:0)
我用私人IP取代了公共IP,效果很好。现在,我可以正确ping我的远程机器。