Configuring "httpd"? webserver on docker container through Ansible Automation Tool :

Configuring "httpd" webserver on docker container through Ansible Automation Tool :

Task Description :

1 . Writing An Ansible Playbook that does the following tasks 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.

Introduction :

No alt text provided for this image

What is Ansible ?

Ansible is an open source automation platform. It is very, very simple to setup and yet powerful. Ansible can help you with configuration management, application deployment, task automation. It can also do IT orchestration, where you have to run tasks in sequence and create a chain of events which must happen on several different servers or devices. Ansible is rapidly rising to the top in the world of automation tools. Let’s look at some of the reasons for Ansible’s popularity.

How Ansible Works ?

Ansible works by connecting the server of the user through the SSH keys and pushing the small programs out. With the use of modules, the playbooks help the ansible clients in performing all the specific tasks. The particular functions can include the service of restarting, installing packages, rebooting servers, and much more. With the use of Ansible, a lot of things can be performed.

1. Setting the Architecture

2. SSH Keys

3. Managing Inventory

4. Using Ansible

5. Ansible Playbooks

Ansible Architecture

No alt text provided for this image

* The steps we need to follow to configure Apache webserver on top of Docker using Ansible Automation tool are as follows:

Step 1The first and the most important step in Ansible is to setup Control node and for that first we need to install ansible in control node.

No alt text provided for this image

Check whether ansible installed successfully or not .

No alt text provided for this image

Step 2Create inventory file and add details of all the target nodes in that inventory file.

[root@localhost ~] #vim ip.txt
No alt text provided for this image

Step 3Create configuration file for ansible and include inventory in configuration file.

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

Step 4Now create playbook to configure apache webserver on docker.

No alt text provided for this image
[root@localhost ~]# vim docker.yml


No alt text provided for this image

Step 5Run the playbook and check whether its working properly or not.

[root@localhost ~]# ansible-playbook docker.yml
No alt text provided for this image
No alt text provided for this image

Let's check whether all the steps have been successfully done or not on Managed Node.

Docker repository configured successfully.

No alt text provided for this image

Docker installed and service started and enabled successfully.

No alt text provided for this image

Pulled docker httpd image successfully.

No alt text provided for this image

Launched docker httpd container successfully.

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

We have successfully configured Apache Webserver on Docker Container using Ansible Automation Tool.

I hope you like my Article , Thank You !








要查看或添加评论,请登录

Yash Raj的更多文章

  • How Industries are solving challenges using Ansible :

    How Industries are solving challenges using Ansible :

    In this article we are going to discuss what is ansible in devops and its use cases? If anyone ask you about ansible…

  • Task Description :

    Task Description :

    1. Creating a Key-Pair 2.

  • About AWS and its Management

    About AWS and its Management

    AWS (AMAZON WEB SERVICES) Amazon Web Services is a cloud computing platform that provides customers with a wide array…

    2 条评论
  • Big Data and its Challenges

    Big Data and its Challenges

    What is Big Data? Big Data is also data but with a huge size. Big Data is a term used to describe a collection of data…

    1 条评论

社区洞察

其他会员也浏览了