Installing Ansible

Published on 10 November 2018

Modern infrastructure requires modern approaches. The use of cloud, and the increase of non-Windows servers really mean that different tools and techniques are required. Even with Windows servers, you shouldn't be doing your configuration by logging onto the console, and while GPO is traditionally useful, there are limitations, such as the server having to be Windows, having to be in the AD domain, and of course not being Windows 2016 Nano Server.

Powershell is great for Windows environments, and things like WinRM and DSC really expand the functionality and options available, but it can require inventing the wheel to a small degree, and sometimes you need to bring the ability to do Configuration Management and automation to people who can't (yet) use Powershell. That is where something like Redhat's Ansible comes in.

Ansible isn't just for Windows of course, or servers, but if you work with Windows servers already, it is a great place to begin with. Although it doesn't run on Windows, so you will need to get your feet dirty and venture into Linux territory. In terms of where you install it though, Ansible is fairly flexible. You can install it on your linux server (typically referred to as a control server), or on your PC/laptop. Personally, I went with a VM image of Ubuntu 18.04, stood up with Vagrant. Ansible is agentless (unlike, say Chef) so you really can install your ansible software where you want to do your administration/automation from. If you are going to branch out into using Ansible on AWS though, you probably need to think about whether you want your Ansible server inside your VPC, or outside. Inside, you can use internal DNS names, and outside, you will need to use the external DNS names (and don't forget the security considerations).

So to install Ansible on your Linux box, you can you use "apt", but there are probably some things you want/need to do first. Like ssh'ing to your linux box. Do this with putty (if on Windows) or similar, and remember to use the username@ipaddress format when connecting. Then start by running the following:

sudo apt-get update
sudo apt-get install python-pip
sudo pip install xmltodict
sudo pip install pywinrm

Now, you are ready to install Ansible. The 2nd command below will simply report back the version installed.

sudo pip install ansible
ansible --version


Now you have it installed. A fairly painless process. In the next post, I will explain how to actually do something with it.

comments powered by Disqus