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.
Step 2: > Installation of Docker.
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
Step 4: > Create a directory on Managed node or Server and copy one html from Controller node to managed Node.
Step 5: > Disable SElinux for permission issue and print the output
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.
Task completion:
> Container Deployed
> Web page is working
Thank You!!