Sometimes, getting started with a technology solution can be a bit daunting. I have to say that starting out with Ansible felt like that, however once you get started you realise how well thought out the solution is. Given half a day you can get up and running. Don’t get me wrong – you won’t be an expert in half a day! That takes a while longer! Below I have detailed a quick guide to getting up and running with Ansible. You will deploy a single Ansible server on Centos7 and a secondary Centos7 server that you will use to test ansible commands and playbooks against.

 

Caveat: The following guide is to get you up and running quickly in a lab environment. I would not recommend this process for a Production ready deployment

Note: Throughout this guide, I am running as ‘root’ on both servers

 

Prerequisites

  • Ideally you will have a DNS server, with entry records for the Ansible Controller and the Test Server. Failing that, ensure you setup local records on each of the servers allowing for name resolution
  • Create two virtual machines as follows

 

Note: Ensure they can communicate with each other, by IP address and by name. Of course, you can use whichever names and IP information for each server you want, but for completeness I have included mine below

 

ItemValue
RoleAnsible Controller
OSCentos7
Namesnrans01.sonar.lan
IP Information10.0.100.180
255.255.255.0
vCPU1
Memory8GB
Hard Disk72GB
NICs1

 

ItemValue
RoleAnsible Test Server
OSCentos7
Namesnransl01.sonar.lan
IP Information10.0.100.182
255.255.255.0
vCPU1
Memory8GB
Hard Disk72GB
NICs1

 

 

Preparing The Ansible Controller and Test Server

Before we install Ansible, we should ensure that our OS is up to date. Additionally, we need to install a few packages to make our life (sic. my life) easier. All but one package I have installed on both servers as below.

 

ItemCommentTarget
epel-releaseEnterprise Release Packagesnrans01
nanoFor editing files (I'm not a VI guy!)snrans01 & snransl01
net-toolsI like to use ifconfigsnrans01 & snransl01
treeVery handy for getting a layout of directory structuressnrans01 & snransl01

 

You can accomplish this by running the following commands on the Test Server (snransl01.sonar.lan)

Sudo yum update -y
Sudo yum install tree nano net-tools -y

 

On the Ansible Controller (snrans01.sonar.lan) we run the same commands, but include the Enterprise Release pack for installation

Sudo yum update -y
Sudo yum install tree nano net-tools epel-release -y

 

 

Installing The Ansible Controller

Ansible installation is easy and is accomplished with a single yum install command

Ansible has a number of prerequisite packages (such as Python) that are required to ensure Ansible works properly (and in some cases even installs properly). Thankfully, the Ansible package install takes care of this for us, so installing Ansible is as simple as entering a single command on our Ansible Controller server

Sudo yum install ansible -y

 

 

 

 

Ensure Ansible Is Installed Correctly

Check Ansible has installed properly by requesting the Ansible version

Once the installation has completed we can check that Ansible is installed correclty and working by simply checking the version. Assuming everything has been installed and configured correctly, you will be provided an output of version information once you have executed the following command.

ansible --version

 

paul_davey

CIO at Sonar, Automation Practice Lead at Xtravirt and guitarist in The Waders. Loves IT, automation, programming, music