Configuring Apache Webserver on Docker using Ansible automation
What is 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.
Because Ansible is all about automation, it requires instructions to accomplish each job. With everything written down in simple script form, it's easy to do version control. The practical result of this is a major contribution to the "infrastructure as code" movement in IT: the idea that the maintenance of server and client infrastructure can and should be treated the same as software development, with repositories of self-documenting, proven, and executable solutions capable of running an organization regardless of staff changes.
While Ansible may be at the forefront of automation, systems administration, and DevOps, it's also useful to everyday users. Ansible allows you to configure not just one computer, but potentially a whole network of computers at once, and using it requires no programming skills. Instructions written for Ansible are human-readable. Whether you're entirely new to computers or an expert, Ansible files are easy to understand.
How Ansible works?
In Ansible, there are two categories of computers: the control node and managed nodes. The control node is a computer that runs Ansible. There must be at least one control node, although a backup control node may also exist. A managed node is any device being managed by the control node.
Ansible works by connecting to nodes (clients, servers, or whatever you're configuring) on a network, and then sending a small program called an Ansible module to that node. Ansible executes these modules over SSH and removes them when finished. The only requirement for this interaction is that your Ansible control node has login access to the managed nodes. SSH keys are the most common way to provide access, but other forms of authentication are also supported.
Following are the steps we need to follow to configure Apache webserver on top of Docker using Ansible Automation tool:
Step 1: The 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.
Check whether ansible installed successfully or not .
Step 2: Create inventory file and add details of all the target nodes in that inventory file.
Step 3: Create configuration file for ansible and include inventory in configuration file.
Step 4: Now create playbook to configure apache webserver on docker.
Step 5: Run the playbook and check whether its working properly or not.
Let's check whether all the steps have been successfully done or not.
Docker repository configured successfully.
Docker installed and service started and enabled successfully.
Pulled docker httpd image successfully.
Launched docker httpd container successfully
We successfully configured Apache Webserver on Docker using Ansible Automation.
Well done 🌟
Tysm Shubham Mehta for ur help 😅