首页 > 解决方案 > ansible - 使用跳转主机时在横幅交换期间连接超时

问题描述

ansible 命令:ansible all -m ping -i host.yml

这是我的 host.yml

---
all:
  hosts:
    tencent:
      ansible_user: "ubuntu"
      ansible_host: "106.55.XXX.XXX"
      ansible_ssh_private_key_file: "key.pem"
      ansible_ssh_common_args: 'ssh -o ProxyCommand="ssh -i bastion.key.pem ubuntu@102.106.XXX.XXX"'

错误信息:

Failed to connect to the host via ssh: Connection timed out during banner exchange

ansible中如何正确使用跳转主机?

标签: ansiblebastion-host

解决方案


这是可靠的解决方案:

如何配置跳转主机以访问我无法直接访问的服务器?

在我的情况下,只需更换ansible_ssh_common_args

ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q ubuntu@102.106.XXX.XXX -i ./inventory/bastion.key.pem"'

推荐阅读