Configure Apache Webserver on top of Docker Container with help of Ansible Playbook
- Configure Docker.
- Start and enable Docker services.
- Pull the httpd server image from the Docker Hub.
- Run the httpd container and expose it to the public.
- Copy the html code in the/var/www/html directory and start the webserver.
- Should have 2 linux os yum configured.
- Download ansible in master node and configure inventory file Hosts.
Starting with Downloading Docker
Firstly we will configure yum repository for docker in target node for downloading docker and then we will Install docker and will start docker service
We can see docker service is running in our Target Node
Now we will install pip3 command or can say python3 to download docker software development kit (sdk) for integrating docker with ansible
With help of ansible we now download httpd server image from docker hub and will copy content for website in /var/www/html file.
Now we will check in target node that our file index.html is present there or not.
Now we have to expose our container so everybody can see our website
Now if we try to connect with container IP and we see the web page i.e index.html with Output HTTP server on docker which we have written in index.html.
This is final playbook for our entire setup