TASK 14.2 — Further in ARTH — Task 10 have to create an Ansible playbook that will retrieve newContainer IP and update the inventory. So that further Configuration of Webserver could be done inside that Container.
In this article I would like to show you the demo of how to create an Ansible playbook that will retrieve newContainer IP and update the inventory. So that further Configuration of Webserver could be done inside that Container.
For doing this demo we have to follow these steps-:
Step 1: Check whether ansible is properly install. Since in this practical we do it in localhost so there is no need to update the inventory file.
Step 2: Create a workspace that will contain the playbook, code file, file to retrieve IP and other important files.
Step 3: In this workspace firstly create a code file and the inventory file which update after retrieve the ip and a jinja template file which dynamically reterive the ip of container.
Step 4: Now create a ansible playbook which automatically retrieve the ip of container and update the inventory file dynamically.
Step 5: Now run the playbook using command-:
ansible-playbook {filename}.yml
Now, check the inventory file-:
Since we get the container ip so now we check it in browser you can see that-:
TASK COMPLETED !!!
Thank You 😊😊