Inventories – maintaining a single source of truth

We have worked hard throughout this book to build an automation architecture that implements good practices for your enterprise. For example, when it comes to managing your Ansible playbooks and roles, we have strongly encouraged the use of version control systems and including roles from source control so that there is always a single source of truth for your Ansible code.

However, in our examples throughout this book, we have worked with very simple, static inventory files that feature, at most, a handful of hosts. Naturally, your enterprise won't look like this—the whole goal of automation is to be able to handle a large infrastructure of hundreds of machines with ease and grace and to be able to cope with changes in that infrastructure efficiently and effectively.

Most enterprises that begin their automation journey are not starting from scratchit is anticipated that many who read this book will already have a Linux estate of some size that they need to manage more effectively, and so will already have a list of machines that need automation applying to them.

This completes our problem statementimagine that you have an estate of Linux servers comprised of hundreds of machines and have built up a scalable automation system using Ansible and AWX/Ansible Tower, with all code stored in version control and roles actively being reused. Why then would you want to manually type out those hundreds of hostnames into a flat-text inventory file?

Further, whenever a new Linux machine is commissioned (or an old one decommissioned)a not uncommon task in this age of virtualizationimagine having to manually edit that inventory file and ensuring it is in sync with what your estate actually looks like.

In short, this situation is not acceptable. It is not scalable and will very quickly become unmanageable. How can you, to pick one example, be confident that all of the servers in your estate have had the CIS Benchmark applied to them if you are not confident that your inventory contains all your servers to begin with?

Thankfully, Ansible includes a solution to this too, in the form of dynamic inventory script, and we will look at the anatomy of these in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset