Chapter 3. Scaling to Multiple Hosts
In the previous chapters, we have specified the hosts in the command line. This worked fine while having a single host to work on, but will not work very well when managing multiple servers. In this chapter, we will see exactly how to manage multiple servers.
We'll explore the following topics:
- Ansible inventories
- Ansible host/group variables
- Ansible loops
Working with inventory files
An inventory file is the source of truth for Ansible (there is also an advanced concept called dynamic inventory, which we will cover later). It follows the Initialization (INI) format and tells Ansible whether the remote host or hosts provided by the user are genuine.
Ansible can run its tasks against multiple hosts in parallel. To ...
Get Learning Ansible 2 - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.