Configuring HTTPD Server on Docker Container using ansible

Configuring HTTPD Server on Docker Container using ansible

Description📄

🔰Write 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

Control Node IP: 192.168.43.131

Manage Node IP: 192.168.43.238

our worspace: /docker_ansible

No alt text provided for this image

First step is to create a inventory file and enter manage node IP : docker.txt

No alt text provided for this image

We need to add our inventory file to the ansible configuration file /etc/ansible/ansible.cfg

No alt text provided for this image

Now, we create the playbook: playbook docker.yml

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

run playbook :

ansible-playbook docker.yml
No alt text provided for this image

now we check our server : 192.168.43.238:8090

No alt text provided for this image

thank you !!!!

To view or add a comment, sign in

More articles by Sagar Sharma

Explore content categories