Integration of Docker with Ansible
Ansible Integration

Integration of Docker with Ansible

What is Ansible:

Ansible is a Configuration Management tool which is useful in all the platform for configuration for ex- OpenShift Cluster model, Cloud Platform, Web Server, Windows Server patching etc etc.

Ansible works on Push Mechanism.

Ansible tool support YAML language to write a playbook.

Important Points:

Controller Node: This is the node or actual server, where Ansible will be installed and execute the script.

Managed Node: This kind of nodes or server are taking participation on Ansible operation.

Inventory: This is the important file where all the inventory or server or node details will be added by statically or Dynamically.

Config File: This is the configuration file where Ansible configuration are stored.

Tasks Detail:

> Configure Docker

> Start and enabled Docker services

> Pull the official httpd server image from the Docker hub

> Run the httpd container and expose it to the public.

> Copy the html code to html directory or the container and start the web server

Step 1: > Creation of Docker repo file using ansible playbook.

No alt text provided for this image

Step 2: > Installation of Docker.

No alt text provided for this image

Step 3: > To run container one module must be installed which is –> docker-py , after installation capture the installation status on a value [register] and print the output [debug].

Start the docker service permanently

Check the docker service

No alt text provided for this image

Step 4: > Create a directory on Managed node or Server and copy one html from Controller node to managed Node.

No alt text provided for this image

Step 5: > Disable SElinux for permission issue and print the output

No alt text provided for this image

Step 6:>

This is the final task where below steps are performed…

> Pull the Docker Image – HTTPD

> Run the image with a name

> Exposed the port 80 so that web page can be accessible from outside

> Attach the /web directory for permanent storage, so that after termination of container no data loss will be there.

> Print the container running status.

No alt text provided for this image

Task completion:

> Container Deployed

> Web page is working

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

Thank You!!






To view or add a comment, sign in

Others also viewed

Explore content categories