Ansible playbook that will retrieve new Container IP and dynamically update the inventory and Configure web-server inside that Docker Container.

📍📍📍📍📍📍📍📍📍📍📍📍📍📍📍
Task Description📄

♨️ Task — 14.2

Further in ARTH — Task 10 we have to create an Ansible playbook that will retrieve new Container IP and update the inventory. So that further Configuration of Webserver could be done inside that Container.

So Let’s get started……

In this task I have used my own pre-created docker image which is enabled with ssh. So that Ansible can use ssh protocol to login to new docker container and configure webserver inside it.

In my case I am having Controller Node having IP 192.168.43.155 on which the ansible is installed.

↪️ Lets check the ansible version installed on my controller node :

↪️ Initially inventory file is empty.

↪️ Configuration file of ansible :

↪️ Ansible Playbook :

↪️ dockerip.txt file

↪️ Task14.2-html file

↪️ Now let’s run the main Playbook:

↪️ Inventory file dynamically updated

↪️ Check Docker Service started and enabled:

↪️ Successfully Launched docker container with name myweb:

↪️ Now we can run our docker-web.yml playbook to configure webserver inside container:

↪️ Done! Now checking by Attaching to myweb container:

↪️ Now the webserver has been deployed on the docker container with the help of the Ansible Automation tool. So Let’s check our webpage from the browser :

Thankyou for Reading the blog If you have any questions you any queries related to this task ,you can comment below or you can also dm me LinkedIn

LinkedIn :- https://www.linkedin.com/in/vishwajeet-singh-8b3274188

Thankyou All …….!!!!!!!!!!

Signing off for now 😊

Vishwajeet Singh