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.
More on Inventory
What is an inventory and why does Ansible need one?BeginnerWhat are the INI and YAML inventory formats and how do they differ?BeginnerHow do you create groups of groups?BeginnerExplain host patterns: `:`, `:&`, `:!` and wildcards.IntermediateWhich connection variables can you set per host in inventory?BeginnerWhat are `group_vars` and `host_vars` directories?Intermediate