Interview Prep/Ansible/Inventory and Targeting

You are handed a fresh Ansible project and 10 servers. How do you make sure Ansible can reach all of them before writing any playbook?

BeginnerScenarioInventory and Targeting
Answer

Situation read → No playbook yet; the first risk is connectivity, not logic.

What I'd do →

  1. Write an inventory with the hosts and ansible_user/key settings.
  2. Run ansible all -i inventory.ini -m ping.
  3. For failures, rerun with -vvv on one host.
ansible all -i inventory.ini -m ansible.builtin.ping
ansible web01 -i inventory.ini -m ansible.builtin.ping -vvv

Why → ping tests SSH login, Python on the target and module execution in one shot, so a pong means real playbooks will run.

Interview tip → Say that ping is not ICMP; it is a full Ansible round trip.

All Ansible questions Roadmap: Ansible

More on Inventory and Targeting