Configuring Web Server on a Docker Container using Ansible…
What the World needs ?
The Answer to it is Automation
Here’s my Article on Automation using Ansible. I created a Playbook which can automate the configuration of a Web Server on a Docker container . Anyone can use this Playbook without knowing the actual Linux command to set-up all of this with just a click of a button…
If you are a newbie and have no idea of those dark highlighted words above ,then lets give them some meaning first…
Ansible
Ansible is a software tool that provides simple but powerful automation for cross-platform computer support. It is primarily intended for IT professionals, who use it for application deployment, updates on workstations and servers, cloud provisioning, configuration management, intra-service orchestration, and nearly anything a systems administrator does on a weekly or daily basis. Ansible doesn’t depend on agent software and has no additional security infrastructure, so it’s easy to deploy.
Docker
Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels.
So now that you are familiar with the topics in use ,Lets continue with showcase of my Playbook…
So let’s do it. But hold on ,lets first check do we have a connectivity with our managed node
To check , use command: ansible all –list-hosts
And as we can observe in the image below we do have a connectivity with a managed node.
Now i have shared my Playbook in the images given below .Please have a look on how you can achieve the same result by using this Playbook…
Now its time to execute our playbook, so shall we…
Command: ansible-playbook Name_of_your_playbook
Now as you can see my playbook ran successfully …
Now its time to check what we have done is correct or not i.e. our webserver is running or not and for that we would require the IP of our Docker Container.
To get it, on your managed node ,write: docker inspect Container_name
And as you can see you will get the IP of your container
Now Finally ,its time to see that our webpage has been configured over docker container correctly or not..
To check:
Use command: curl IP_of _your_container/html_page_name
And As you can see in the image below our webserver has been configured in docker container successfully!!!!!!
Well that was all from my side , Hope you liked it…
View my Playbook on Github:
— Arjun Nigam