Introduction to Inventories

Get introduced to Inventories and create your own.

You already have a way of inventorying your infrastructure. It might be:

  • By mentally remembering hostnames.
  • By grouping them by a standard naming convention.
  • With a custom database that stores specific properties about the hosts.
  • With a full-blown CMDB (configuration management database) that has entries for all the hosts.

Ansible codifies this information by using an inventory.

Inventories describe your infrastructure by listing hosts and groups of hosts. Using an inventory gives you the ability to share standard variables among groups. Inventories are also parsable with host patterns, giving you the ability to broadly or narrowly target your infrastructure with Ansible automation. In its simplest form, an Ansible inventory is a file.

Let’s suppose that, within an infrastructure, there are three web servers and a database server. The Ansible inventory might look like this.

Get hands-on with 1200+ tech skills courses.