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.

Mihir Patel
Jan 5, 2021

In this story you will see how ansible is detect the new container ip and setup Inventory file automatic .

Before use the container our Inventory is :

Now i write ansible playbook for docker : this container ip automatic put in Inventory file .

👉 First : Our ansible file will retrive_new_containerip.yml :

copying docker and start service

pulling docker image

Launching container and Upadating the ip.txt

Now Run this ansible file :

After Run the File : Docker Ip automatic Updated

👉 Second :Now we will setup web server in Container :

Run This Ansible File So webserver Setup in docker .

So output In browser:

Thanks

--

--

Mihir Patel
Mihir Patel

No responses yet