APACHE WEBSERVER CONFIGURATION IN DOCKER USING ANSIBLE

Rohitbhatt
4 min readJan 11, 2021

🔰What is Docker?

Docker is a set of platform as a service (PaaS) 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. All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines. The software that hosts the containers is called Docker Engine. It was first started in 2013 and is developed by Docker, Inc.

🔰What is Ansible?

Ansible is a configuration management system written in Python using a declarative markup language to describe configurations. It is used to automate software configuration and deployment.

🔰Ansible Architecture :

♦️ Ansible Playbooks :

Ordered lists of tasks, saved so you can run those tasks in that order repeatedly. Playbooks can include variables as well as tasks. Playbooks are written in YAML and are easy to read, write, share and understand.

♦️ Inventory :

A list of managed nodes. An inventory file is also sometimes called a “hostfile”. Your inventory can specify information like IP address for each managed node. An inventory can also organize managed nodes.

♦️ Control Node:

Any machine with Ansible installed is known as controller node. You can run Ansible commands and playbooks by invoking the ansible or ansible-playbook command from any control node. You can use any computer that has a Python installation as a control node - laptops, shared desktops, and servers can all run Ansible. However, you cannot use a Windows machine as a control node. You can have multiple control nodes.

pip3 install ansible
yum install sshpass
#To see version of ansible installed
ansible --version

♦️ Managed Node:

The network devices (and/or servers) you manage with Ansible. Managed nodes are also sometimes called “hosts”. Ansible is not installed on managed nodes.

🔰To check connectivity with all Managed Nodes:

ansible all -m ping

so lets begin the practical…….

🔰In PlayBook :

🔰After this, run playbook :

ansible-playbook -v docker.yml

🔰To check docker is configured and services are started in Managed Node :

docker --version 
systemctl status docker

🔰To check container is launched :

docker ps -a

🔰To check IP of Docker Container:

docker inspect httpd-web | grep IP

🔰Let’s check on Browser :

For Furthur Queries, Suggestion’s Feel Free to Connect with me On Linkedin.

www.linkedin.com/in/rohit-bhatt-97499b188.

Thank you!!!!!!!!!

--

--