Configure Docker with the help of Ansible and start Docker Service and Httpd service

Hii guys….

Today, I am creating an ansible playbook to configure docker and install the httpd server over docker to launch a web page on that.

First of all, we have to configure the yum repository on a managed node by using ansible or by manually.

We have to mount the iso file in the machine so we can get the path of the AppStream and BaseOS.

In Ansible, there is a module to configure yum, and the module name is “yum_repository”. which we can give the name, baseurl, path, etc…

And then, we have started the process of configuring the docker and httpd server .

We have to again use the yum_repository module to configure docker.

which we have to provide this link from the internet which is for baseurl.

Then we have to install the docker community edition manually it is not installed we have to add some extra attributes to install docker which is “ — nobest” .

For ‘nobest’ there is no module in ansible to define this so we can run the whole command under the command module and start the service of docker.

And then, launched the docker container, but the docker container gives an error which is solved by install ‘docker-py’ , this error did not come when we launch manually.

launch the httpd server over the docker container and start the httpd service which port number is ‘8080’ or ‘80’(default) and copy the web page from the controller node to managed node.

And then we have to check successfully docker container and web page run or not let’s see….

Yes, the docker container launched successfully.

Web page is successfully launched….

Thank you…