最近部署aws服务,因为国内连aws特别慢,弄了一台跳板机,用专线连到aws,之前的ansible部署脚本也需要支持跳板机跳转部署

折腾好久找到解决方法:

1、配置~/.ssh/config

Host machinename                     //目标机
HostName x.x.x.53
User land
Port 22
IdentityFile ~/.ssh/id_rsa
ProxyCommand ssh quick 'nc %h %p'

Host jump                      //跳板机
HostName x.x.x.209
User deploy
Port 6600
IdentityFile ~/.ssh/id_rsa

2、配置ansible的host

[server]

machinename

这样就可以了,其他部分和直连一样

另外我有个疑问:官方文档说可以使用下面这个参数配置,但是我没搞定,会的同学可以指点我一下,上面的方法有问题也问我

--ssh-common-args=SSH_COMMON_ARGS
specify common arguments to pass to sftp/scp/ssh (e.g.
ProxyCommand)

相关文章:

  • 2021-11-14
  • 2021-08-27
  • 2021-05-04
  • 2021-06-23
  • 2021-08-27
  • 2022-12-23
  • 2021-11-17
猜你喜欢
  • 2021-05-22
  • 2021-12-30
  • 2021-11-04
  • 2021-06-13
  • 2021-05-28
  • 2022-12-23
  • 2021-08-29
相关资源
相似解决方案