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

ARTH — Task 14 👨🏻💻
Task Description📄
🔰 14.2 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.
👉🏻Lets 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 :
# ansible --version

✔️ Initially inventory file is empty
# cat /root/ip.txt

✔️ Configuration file of ansible :
# vim /etc/ansible/ansible.cfg

🔶 Ansible Playbook :
# vim docker.yml

# vim docker-web.yml

✔️dockerip.txt file

✔️ task14_2.html file

✔️ Now let’s run the main Playbook:
# ansible-playbook docker.yml

✔️ 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:
# ansible-playbook docker-web.yml

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 :
