Installing Ansible

Ansible is an open source IT automation engine that automates provisioning, configuration management, application deployment, orchestration, and many other IT processes. Ansible works by connecting to the destination machines nodes and pushing out small programs, called modules, to them.

Basic Ansible concepts

These concepts are common to all uses of Ansible. You need to understand them to use Ansible for any kind of automation.

Control node

Any machine with Ansible installed. You can run Ansible commands and playbooks by invoking the ansible or ansible-playbook command from any control node.

Managed nodes

The network devices (and/or servers) you manage with Ansible. Managed nodes are also sometimes called “hosts”. Ansible is not installed on managed nodes.

Inventory

A list of managed nodes. An inventory file is also sometimes called a “hostfile”. Your inventory can specify information like IP address for each managed node.

Tasks

The units of action in Ansible. You can execute a single task once with an ad hoc command.

Playbooks

Playbooks are ordered lists of tasks, saved so you can run those tasks in that order repeatedly. Playbooks can include variables as well as tasks. Playbooks are written in YAML and are easy to read, write, share and understand. Playbooks tell Ansible what step the user wants to execute on a particular machine in a repeatable and re-usable way, well suited to deploying complex applications. They are like a to-do list for Ansible that contains a list of tasks.

Requisites

Quobis Communication platform installation requires a machine from where all Ansible and other script commands are issued ((which could easily be a laptop). This machine where Ansible is installed is called the “control node” and can be part of the cluster or a separate dedicated machine. The idea behind this is to have a unique element where the support access is centralized. No direct access to the working cluster is required, just access to this working station.

Check the following requirements on the machine where you will to run the Ansible installer:

  • Supported OS: Debian 9 or higher and Ubuntu 16.04 or higher

  • At least 2GB of RAM

  • Ensure that all the target machines have network visibility with the Ansible script installer and are reachable via a SSH connection.

  • Includes sudo and an accessible user included on sudoers: sudo usermod -aG sudo <host_username>

Installing Ansible on Ubuntu

To configure the PPA on your machine and install Ansible run these commands:

1$ sudo apt update
2$ sudo apt install software-properties-common
3$ sudo apt-add-repository --yes --update ppa:ansible/ansible
4$ sudo apt install ansible

Note: On older Ubuntu distributions, “software-properties-common” is called “python-software-properties”. You may want to use apt-get instead of apt in older versions. Also, be aware that only newer distributions (in other words, 18.04, 18.10, and so on) have a -u or –update flag, so adjust your script accordingly.

Installing Ansible on Debian

Debian users may leverage the same source as the Ubuntu PPA.

Add the following line to /etc/apt/sources.list:

deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main

Then run these commands:

1 $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367
2 $ sudo apt update
3 $ sudo apt install ansible

Note: This method has been verified with the Trusty sources in Debian Jessie and Stretch but may not be supported in earlier versions. You may want to use apt-get instead of apt in older versions. Further documentation about Ansible installation can be found in the Ansible website.

More information

In case of any issue with the Ansible instalation, you can check the official installation guide that can be found here: https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html