Ansible – Getting started – Part 1


As I started recently to concentrate more IT automation (e.g. for infrastructure, containers or even cloud) I decided to start playing with Ansible. In the last couple of weeks and months I heard about Ansible quite often, which is why I wanted to know more about it.

So what is Ansible?

Ansible is an IT automation engine, which helps IT admins automate their daily, repetitive tasks like deploying and configuring various systems. Even though many solutions like VMware offer orchestrators for their own solutions, they are often not as vendor-agnostic as Ansible. It supports automation scripts called “playbooks”, which are written in YAML.

After playing a bit with Ansible, I decided to write a small series of posts, documenting my own learning path. This includes first basics, installation steps, first playbooks interacting with VMware etc.

Those interested in Ansible, what it is or does can read more on the official website.

Sounds cool, where do I start?

There are many possibilities to install Ansible, be it the Python version or standard (Python is not supported on Windows today). I would like to document as easy and quickly as possible how I managed to install and configure Ansible. I chose Ubuntu as distribution, but Ansible is also supported on other distributions like RHEL, CentOS etc.

Ansible installation

Ansible is a simple application to be downloaded, and runs on either Linux or Mac Systems. I chose to deploy an Ubuntu VM to run it.

  1. If you want to run it in a VM, deploy and prepare your VM, and patch it to the latest available version.
    Note that a minimal installation can be sufficient. All the VM requires is access to the internet.
  2. Run following commands: (The first one installs Python, the second one pyvmomi, the third one installs Ansible)

sudo apt-get install python-setuptools
sudo pip install pyvmomi
sudo pip install ansible


That’s it! There’s not more to be done to get Ansible installed.

If you have another distribution like Fedora, CentOS/RHEL, the commands might be slightly different (like replace apt-get by yum). You can find the detailed instructions for other supported systems in the Installation Guide of the official website.

Test the installation

You can test if the installation was successful by launching a simple command like ping. To do this, simply launch following command in a console: ansible -m ping

If the value returned for a “ping” is “pong”, then your installation was successful.

user@ubuntu:~/Documents$ ansible -m ping | SUCCESS => {
"changed": false,
"ping": "pong"


Another thing you can test is the pyvmomi version, which is used to access the VMware SDK (pyVmomi is the Python SDK for the VMware vSphere API used to manage vCenter and ESXi. vmomi is short for “Virtualization Management Object Management Infrastructure”).
This version should be at least the vSphere version you want to access.

Check pyvmomi version:

user@ubuntu:~/Documents$ pip show pyvmomi

Name: pyvmomi
Version: 6.7.1
Summary: VMware vSphere Python SDK
Author: VMware, Inc.
License: License :: OSI Approved :: Apache Software License
Location: /usr/local/lib/python2.7/dist-packages
Requires: requests, six




This concludes the first article in this blog series. At the beginning I spent quite some time finding the information which really matters, but in the end the installation and first test were really simple.
The next article will cover the first playbooks I ran against an ESXi host.

Stay tuned! 🙂

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.