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.
- 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
|Role||Ansible Test Server|
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.
|epel-release||Enterprise Release Package||snrans01|
|nano||For editing files (I'm not a VI guy!)||snrans01 & snransl01|
|net-tools||I like to use ifconfig||snrans01 & snransl01|
|tree||Very handy for getting a layout of directory structures||snrans01 & 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 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
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.