अर्थ Program Task — 10

SIBAYAN BAG
3 min readMar 15, 2021

Task Description :
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

The Only prerequisite is :

Yum must be configured in managed node :

To check use command : yum repolist

Now create the inventory file with any name with extension .txt and fill with the details of managed node with the username, password and connection ….

Now Fill the details…..

Now Check the managed is connected successfully or not :

command : ansible all -m ping

Now check in the managed node that docker is install or not :

command : rpm -q docker-ce (in managed node)

As from the above we can see that docker is not yet install in the OS.

Now we use Ansible playbook to configure the docker and set up the web server on the top of the container…..

create a .yml file and write the code for configuring docker and setup web server.

Now write the following yml code :

Now to run the Ansible playbook:

command : ansible-playbook file_name.yml

Now check in the managed node that docker is installed or not :

command : rpm -q docker-ce (in managed node)

Now check the httpd image is successfully downloaded or not :

command : docker images

Now check the container is launched or not :

command : docker ps

Now to check the web server is running or not we need to find out the IP address of the container :

command : docker inspect OS_name | grep IPAddress

Now type the IP address in the browser and check the output is coming or not. If it is coming then the web server is successfully configured inside the container.

Hence the Task Completed !!!

Thank you for reading !!!

--

--