Junior — Middle
Have you applied dynamic inventory management in Ansible?
sobes.tech AI
Answer from AI
Yes, dynamic inventory management in Ansible is used for flexible definition of hosts and groups during playbook execution. Instead of a static inventory file, scripts or plugins that return the current list of hosts can be used.
For example, a dynamic inventory can fetch data from cloud providers (AWS, GCP), databases, or other sources.
An example of using a dynamic inventory via a script:
- Create a script that outputs JSON describing the hosts.
- Call ansible-playbook with the
-i path/to/scriptparameter.
This allows for automatic scaling of infrastructure and managing hosts without manually updating inventory files.