Ansible is a server management tool.
It is used to manage and administer multiple servers from a central computer.
Ansible doesn’t need any configuration on the server side as Chef or Puppet. You just install Ansible on your computer and manage or administer servers via SSH.
To Begin with, If your Virtual Machines are lunched locally, then you might need to install a hypervisor like Virtual Box in your local PC (Host OS).
Once you have Virtual Box running, you can install as many VMs as you need.
We will use CentOS 8 which can be downloaded Here as the controller/server and 2 other VMs for this project.
NOTE: The choice of these VMs depends on which ones can run successfully on Virtual Box.
Here are two tutorials on installing VMs in virtual Box
This part is optional and can also be done with the Virtual Box interface
Virtual Box has a Module called VBoxManager which can be used to manage and control all installed Virtul Machines through the Host Machine's Command Line Interface (CLI)
Below is a description of managing the VMs using Windows and Linux distributions
In Windows, you will need to download the Vm-Manager-windows.bat file to your local machine (Host).
Any of the below Methods can be used
- The file can be downloaded by opening the code on github and click
Ctrl
+Shift
+S
. - Alternatively, you can download the file by clicking the download button as shown below.
if you have Virtual Box installed in a another location other than C:\Program Files\Oracle\VirtualBox
, you need to change the file path of the vm-manager-windows.bat
file in line 6
with the path to where virtual box is installed.
Execute the file by double clicking the vm-manager-windows.bat
file or running it as an administrator.
An in-depth introduction of Managing VMs with VBoxManage can be found here.
Similar to windows OS, the VBoxManage module is used to manage VMs.
First, you need to download the script vboxmanage-linux.sh
to your local PC using the command:
wget https://raw.githubusercontent.com/Ndarugaa/Auto-configuration-of-virtual-Machines-with-ansible/main/vboxmanage-linux.sh
Next, you need to give permissions and execute the file
sudo chmod +x vboxmanage-linux.sh
./vboxmange-linux.sh
First, you need to download the script to your Centos 8 Virtual Machine. You can use the wget command to do this directly from the terminal:
wget https://raw.githubusercontent.com/Ndarugaa/Auto-configuration-of-virtual-Machines-with-ansible/main/install-ansible.sh
This command will download the script and save it as install-ansible.sh in your current directory.
Before you can run the script, you need to make it executable. Use the chmod command for this:
sudo chmod +x install-ansible.sh
Run the Script: Once the script is executable, you can run it using the following command:
./install-ansible.sh
This will execute the script, which will then perform its tasks.