Installing Ansible on Ubuntu

So, the plan is to create some posts about ansible, its uses with examples for vmware and cisco devices. Here is just a quick blog on installing ansible control host in Ubuntu. I will be using an ubuntu desktop for my example below.

I will be installing this the way I learned, using the python package manager, pip, but keep in mind there are a few different ways to do this. Before I start, here are a few positives ive garnered from doing this all via pip.

PIP installed ansible Benefits:

  • Install multiple versions of ansible (using pip)
  • End user has direct/specific control over what version of ansible is used/installed
  • pip installs are generally easy to upgrade the ansible distro
  • Installation on MacOS – yes this is the preferred way to install ansible according to ansible documentation
  • installation on Windows – I dont believe its directly supported but you can use the Windows Unix subsystem to do the installation
  • Linux Installation – Yep, for sure it definitely works here ๐Ÿ™‚

Ok to start, ive already made sure to do a quick

sudo apt-get update && sudo apt-get upgrade

Side note you can run apt list --installed to see what is already installed on your system

Then install the following:

  • python3 – installs python if you need it, im running ubuntu 18.04 LTS and it had py3 installed already
  • virtualenv – used to create isolated Python environments
  • python3-pip –
  • build-essential –

sudo apt-get install python3 virtualenv python3-pip

Next I made a directory in my home folder called ansible

mkdir ansible then cd ansible and enter the directory

Now to create the first virtual environment id like to use

virtualenv -p python3 venv36

We can also validate that env has python3 installed

ls venv36/lib/

You will then active the environment with source env/bin/activate and deactivate simply with deactivate

Next, simply we can now do pip install ansible

Scroll to Top