Configure Webserver Inside the docker container with the help of ansible-playbook
🔰 An ansible-playbook that does the
following operations in the managed nodes:
🔹 Configure Docker
🔹 Start and enable Docker services
🔹 Pull the httpd server image from the Docker Hub
🔹 Run the docker container and expose it to the public
🔹 Copy the html code in /var/www/html directory
and start the web server
👉 Pre requisites For this setup is:-
- Two system which have Rhel8 installed or “for perform this setup I use virtualization tool”
- Local dnf Configured in both system
- install python3 in One system which you want to make as “Controller Node”, for this you use CMD “dnf install python3 -y”
- install ansible package in controller node for this use CMD:- “pip3 install ansible -y”
👨💻 Lat’s start working on the setup:-
Step 1: First create an inventory file Where you put the IP and user name, user password and protocol for connectivity:-
Step 2: Create a configuration file for the ansible where you put the info about inventory file “vim /etc/ansible/ansible.cfg”
Here inventory=<path of your inventory file>
Step 3: Write ansible-playbook file (you can download from the my GitHub repository mentioned in blow)
Step 4: Check Connectivity with “Manage Node”
Step 5: Run ansible-playbook in Controller Node
NOTE: here I’m not uploading all the images
YOUR ENTIRE SETUP IS READY
Step 6: Now Check Docker-ce install in controller node Or not
Step 7: Check services of docker started or not
Step 8: Check docker image is pulled or not
Step 9: Check port 8484 is enabled for docker or Not
Step 10: Check docker container started or not
Final Output :-
Thank You