Mastering Development System & Network

How to use ansible through bastion to private subnet in AWS

I have been trying to figure this out for the past 2 days and am getting no where

What I am trying to do is from my home server (Centos7) run ansible playbooks to configure AWS linux (centos7) servers on a private subnet in AWS.

If I run:

sshpass -p "PASSWORD" ssh -i "/aws_ssh/KEY_PAIR.pem" -o "StrictHostKeyChecking=no" -t ansibleuser@PUBLICBASTIONHOSTIP 'sshpass -p "PASSWORD" ssh -i "/aws_ssh/KEY_PAIR.pem" -o "StrictHostKeyChecking=no" ansibleuser@PRIVATEHOSTIP'

I can connect to from my home to my AWS server on the private subnet

Articles I have followed:

None seem to work

What I am trying to achieve is when I run:

ansible all -m ping

As the ansibleuser on my home server I can ping the servers on the private subnet on AWS

What I do not want to do is log into the bastion host and then run ansible commands.

Leave a Reply

Your email address will not be published. Required fields are marked *