Managing the inventory file manually can be a problem. In an environment where instances are booted up and destroyed very frequently, a text-based inventory file can easily go out of sync from the actual infrastructure. In such cases, we can use dynamic inventory, which will help us generate the list of compute instances and other resources in real time. Ansible's GitHub repository has a dynamic inventory script for OpenStack.
Dynamic inventory
How to do it...
Let's download the dynamic inventory script and set the executable bit as follows:
$ curl https://raw.githubusercontent.com/ansible/ansible/devel/contrib/inventory/openstack.py > openstack.py
$ chmod +x openstack.py
After we set the executable bit, we need...