Chapter Two

Inventory

The list of machines Ansible can manage and the groups they belong to — from a hand-written INI file to cloud dynamic inventory that always sees the servers that actually exist.

6 topics

A playbook says what to do; inventory says to whom. It is the list of hosts Ansible can reach, the groups they fall into, and the variables that ride along with each. Get the inventory right and a single playbook runs cleanly against staging or production by swapping one flag; get it wrong and a change meant for one host reaches the whole fleet.

This chapter builds the Larkspur inventory from the ground up. The model of hosts and groups, the two static file formats, where variables live, how patterns target a subset, and finally dynamic inventory that queries the cloud so the host list is generated rather than maintained. Six pages that turn "which hosts?" from a guess into a thing you can verify before every run.

Topics in This Chapter