In this blog post, we will configure an Apache web server on a Linux Machine (Azure Virtual Machine) using Ansible. Apache web server is a free and open-source software that allows users to deploy their websites on the internet.
So, let's dive in.
Ansible is an open-source automation tool that can be used to automate the configuration of servers and systems. It is a command-line IT automation software application that automates cloud provisioning, configuration management, application deployment, and many other IT needs. Read more about Ansible here: https://docs.ansible.com/ansible/latest/index.html
Let's connect to our virtual machine via SSH. If you have not already created a vm, you can follow this link to automate creation of virtual machines on Microsoft Azure with Terraform. Connect to the virtual machine:
ssh linuxuser@ip_address
Make a directory/folder for this Ansible project and change directory to this folder.
mkdir ansible
cd ansible
Make a file for the installation of Ansible. We will call this file installations.sh
.
nano installation.sh
Copy the code below into the fileĀ installation.sh
Note that python is required to perform Ansible operations, hence it needs to be installed also.
#!/bin/bash
sudo apt update
sudo apt install python3-pip
pip install boto3 botocore
pip install boto
sudo apt install ansible
Run the command to change the permission of the file and make it executable.