Configuring Webserver inside Docker Container By using Ansible (14.2)
TASK DESCRIPTION📄
Further in ARTH — Task 10 we have to create an Ansible playbook that will retrieve the new Container IP and update the inventory. So that further Configuration of the Web server could be done inside that Container.
So let’s get started…
In this task, we have used our own pre-created docker image which is enabled with ssh. So that Ansible can use ssh protocol to log in to the new docker container and configure the webserver inside it.
In my case, we are having Controller Node having IP 192.168.43.155 on which the ansible is installed.
Step-1: Check the ansible version installed on the controller node
Step-2: Initially inventory file is empty
Step-3: Configuration file of ansible
Step-4: Create an Ansible Playbook
Step-5: Create dockerip.txt file
Step-6: Create Task14.2-html file
Step-7: Now let’s run the main ansible playbook
Step-8: The inventory file was dynamically updated
Step-9: Check whether the docker service was started and enabled
Step-10: Successfully docker container was launched with name myweb
Step-11: Now we can run our docker-web.yml playbook to configure the webserver inside the container
Step-12: Now check by attaching to myweb container
Step-13: 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
Finally, we had successfully retrieved the new container IP, dynamically updated the inventory, and also configure the webserver inside that docker container.
Thanks for Reading!!