Ansible Bastion – How to run playbook on remote hosts using Bastion
In General, We know it is a an easy job to connect to remote hosts from Ansible control machine ( where you execute ansible playbook) because it is agent less
But in industry we do not directly connect from our laptop (mac/windows) to the servers. For security reasons, we will first login to the Jump Server also known as?Bastion host.
With SSH Forwarding mechanism it is possible you can login to the remote server directly by using the Bastion as a tunnel and this process is technically known as?SSH Forwarding.
We can do this process in SSH using ProxyCommand
ProxyCommand (Forwarding stdin and stdout)
The ProxyCommand itself is a specific command used to connect to a remote server
Now using SSH Forwarding technique we run Ansible playbook on a remote host by using the Bastion as a tunnel
Write same SSH ProxyCommand in ansible inventory