1.

How to setup a jump host to access servers having no direct access?

Answer»

First, we NEED to SET a ProxyCommand in ansible_ssh_common_args INVENTORY variable, since any arguments specified in this variable are added to the sftp/scp/ssh command line when connecting to the relevant host(s). For example

[gatewayed]staging1 ansible_host=10.0.2.1staging2 ansible_host=10.0.2.2

To create a jump host for these we need to add a command in ansible_ssh_common_args

ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q user@gateway.example.com"'

In this way whenever we will try to CONNECT to any host in the gatewayed group ansible will APPEND these arguments to the command line.



Discussion

No Comment Found