Ansible SSH: Using Bastion

Yago Nobre
1 min readAug 16, 2017

--

A time ago I was trying to create a project with terraform and ansible that deploy a kubernetes cluster on aws. I put all of kubernetes nodes, in privates subnets. Of course I have a bastion host that allow me to run ssh in the nodes.
This was a simple project, a terraform module build an AMI that is used as base for all nodes. I have others terraform modules that create a vpc and some subnets, configure security groups, s3 buckets, route53 and some instances.

After the terraform run, I use some ansible playbook to configure some things, for this I need to use the bastion as bridge to ssh all nodes.

After some research, I think that I found a good way to configure it.

Just put it in you vars and all ssh connection will use the bastion, don't forget to change the bastion_ip and user vars.

--

--