Retrieving Container IP for Ansible inventory
This Task in continuation of task10. After installation and launching of docker service in managed node now We need to fetch the container IPs in order to use these containers launched as a part of Ansible inventory.
Inventory is the list of all the IP that need to be controlled by ansible. Fetching IPs for the purpose of inventory is time consuming and hectic too.
Imagine the situation in IT departments where there are thousands of servers running that need to be maintained by ansible fetching IP of each and every system is difficult. Also suppose that for one time we fetched the IPs then for some reason the IP changed or the server went off and another server or container is launched for replacement then this is very much difficult to again take IP and make updates in inventory.
Making inventory dynamic is the most demanding feature and in this task we are automatically fetching the IP of containers launched and make them a part of Ansible inventory.
Step 1 to Step 5 Remains same as of task10
Step 6: Fetching IP and displaying (optional)
Step 7: Registering IP in inventory list
A video of complete Demonstration is below