You are currently viewing Ansible Dynamic Inventory For AWS

Ansible Dynamic Inventory For AWS

Ansible Dynamic Inventory For AWS

Hello Everyone

Welcome to CloudAffaire and this is Debjeet.

In the last blog post, we have discussed inventory in Ansible.

https://cloudaffaire.com/ansible-inventory/

In this blog post, we will discuss Ansible dynamic inventory. We will also configure Ansible dynamic inventory for AWS.

What is Ansible Dynamic Inventory?

If your Ansible inventory fluctuates over time, with hosts spinning up and shutting down in response to business demands, the static inventory solutions described in the previous blog post will not serve your needs. Ansible also supports dynamic inventory where the inventory automatically gets updated with the change in your infrastructure. Ansible dynamic inventory supports tracking of hosts from multiple sources like cloud providers, LDAP, Cobbler, and/or enterprise CMDB systems. Ansible supports two ways to connect with external inventory: Inventory Plugins and inventory scripts.

Next, we are going to configure Ansible dynamic inventory for AWS through scripts.

Prerequisite for this demo:

  • AWS EC2 instance with AWS Linux 2 and internet access
  • IAM role with admin access
  • Ansible
  • Python, boto

Ansible Dynamic Inventory for AWS Demo:

Hope you have enjoyed this article. In the next blog post, we will discuss Ansible Playbook.

To get more details on Ansible, please refer below Ansible documentation.

https://docs.ansible.com/