From the course: Red Hat Certified Engineer (EX294) Cert Prep: 3 Managing Systems with Ansible

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using dynamic inventory scripts

Using dynamic inventory scripts

From the course: Red Hat Certified Engineer (EX294) Cert Prep: 3 Managing Systems with Ansible

Start my 1-month free trial

Using dynamic inventory scripts

- [Instructor] The alternative way to use Dynamic Inventory is by using an inventory script. To do so, you need to place an INI configuration file for it in /etc/Ansible. Then you need to either create the inventory script or download one. Inventory scripts can be written in any language. They gather dynamic inventory data from external sources and display the output in JSON format. For instance, if you're using an Amazon EC2 inventory script, your INI configuration file would be /etc/Ansible/EC2.ini. I'm not going to show you all of that file as it's long, but it will have configuration items specific to the inventory source. For EC2, that might include the region that your VMs are in, as well as authentication token information. To run a playbook with Dynamic Inventory, we specify the inventory script instead of an inventory file with a -i option. This would use the ec2.py script to create your inventory list.…

Contents