How do you reach hosts in a private subnet through a bastion host?

IntermediateConceptInventory
Answer

Set an SSH ProxyJump (or ProxyCommand) for those hosts. The cleanest way is as a group variable.

[private:vars]
ansible_ssh_common_args='-o [email protected]'

Or put it in ~/.ssh/config so plain ssh works the same way. In AWS, alternatives that need no bastion are SSM Session Manager with the community.aws.aws_ssm connection, or EC2 Instance Connect Endpoint.

All Ansible questions Roadmap: Ansible

More on Inventory