There are environments where you have a system that creates and destroys machines automatically. We will see how to do this with Ansible in Chapter 5, Going Cloud. In such environments, the list of machines changes very quickly and keeping the
hosts file becomes complicated. In this case, we can use dynamic inventories to solve the problem.
The idea behind dynamic inventories is that Ansible will not read the
hosts file, but instead execute a script that will return the list of hosts to Ansible in JSON format. This allows you, for instance, to query your cloud provider and ask it directly, what machines in your entire infrastructure are running at any given moment.
Many scripts for the most common cloud providers are ...