CREATNG DOCKER DYNAMIC INVENTORY USING ANSIBLE & CONFIGURING WEBSERVER INSIDE DOCKER

CREATNG DOCKER DYNAMIC INVENTORY USING ANSIBLE & CONFIGURING WEBSERVER INSIDE DOCKER


ARTH — Task 14.2

Task Description📄

Further in ARTH — Task 10 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.


Initially inventory file is empty

cat /root/ip.txt

Configure ansible.cfg

vim /etc/ansible/ansible.cfg

No alt text provided for this image

Ansible Playbook :

vim docker.yml


No alt text provided for this image
vim docker-web.yml

No alt text provided for this image

dockerip.j2 file

No alt text provided for this image

Task14.html file

No alt text provided for this image

Now let’s run the Playbook

ansible-playbook docker.yml


No alt text provided for this image
No alt text provided for this image

Container is successfully launched with name Webos.

Inventory file dynamically updated

No alt text provided for this image

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

No alt text provided for this image

Now checking webos container:

No alt text provided for this image

Now the webserver has been deployed on the docker container.

So Let’s check our webpage from the browser:

No alt text provided for this image



No alt text provided for this image





To view or add a comment, sign in

More articles by GAURAV SINGH SHEKHAWAT

Insights from the community

Others also viewed

Explore topics