Skip to main content

Installing Ansible

Introduction

Ansible is an open-source automation tool that automates software provisioning, configuration management, and application deployment. It uses YAML, a straightforward language, to define automation jobs in a way that is easy to understand and write, making it an excellent choice for sysadmins, developers, and IT professionals.

Before we start using Ansible, we need to install it. This tutorial will guide you on how to install Ansible on a Ubuntu system.

Prerequisites

  • A computer with Ubuntu 20.04 or later installed.
  • Sudo privileges on your system.

Step 1: Update Your System

First, it's always a good idea to make sure your system package list and the system itself are up to date. Open your terminal and type the following commands:

sudo apt update
sudo apt upgrade

Step 2: Install Software Properties Common

Ansible is not available in the default Ubuntu repositories. Therefore, we need to add a repository that contains Ansible using the software-properties-common package. Install this package using the following command:

sudo apt install software-properties-common

Step 3: Add Ansible Repository

Now, we will add the Ansible repository with:

sudo apt-add-repository --yes --update ppa:ansible/ansible

Step 4: Install Ansible

With our system updated and the Ansible repository added, we can proceed to install Ansible:

sudo apt install ansible

Step 5: Verify Ansible Installation

After the installation is complete, you can verify that Ansible is installed and check its version with:

ansible --version

You should see output similar to this:

ansible [core 2.11.1] 
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.8.5 (default, Jan 27 2021, 15:41:15) [GCC 9.3.0]

Conclusion

Congratulations, you have successfully installed Ansible on your Ubuntu system! Now you're ready to start automating your tasks using Ansible. In our upcoming tutorials, we will learn how to use Ansible to automate tasks in different environments. Stay tuned!