Interview Prep/Ansible/Inventory and Targeting

You must configure servers in a private subnet that is only reachable through a bastion.

IntermediateScenarioInventory and Targeting
Answer

Situation read → No direct route from the control node; SSH has to hop.

What I'd do →

  1. Set a ProxyJump in the inventory group vars.
  2. Keep the bastion's key and the private hosts' key separate.
# group_vars/private.yml
ansible_ssh_common_args: >-
  -o [email protected]
  -o StrictHostKeyChecking=accept-new

Test with ansible private -m ping.

Why → Ansible shells out to OpenSSH, so any native SSH feature works with ansible_ssh_common_args.

Interview tip → Mention SSM Session Manager as the bastion-less alternative in AWS (aws_ssm connection plugin).

All Ansible questions Roadmap: Ansible

More on Inventory and Targeting