Install Ansible on Ubuntu – Easy Step-By-Step Guide

Filed Under: UNIX/Linux
Install Ansible On Ubuntu

In this article, we go over the step-by-step method to install Ansible on Ubuntu.

When working from multiple locations or servers, you need a way to synchronize configurations across devices.

This is a common requirement in major organizations and has led to a variety of developments in the networked software technologies.

Configuration management systems essentially allow a single system, referred to as ‘Control Node’, control multiple host systems in an automated manner.

While there are many great configuration management tools available in the market, Ansible has been the easiest one to get started with.

A Little About Ansible

Developed by Red Hat Inc. and Ansible Inc., this configuration management system was made with a focus of creating a tool that is simple, easy to use, and powerful.

Ansible helps simplify the process of automating cloud provisioning, configuration management, application deployment, intra-service orchestration, and many other IT needs.

The modular nature of Ansible in server administration means that you can create modules in any language to extend the functions of your control node.

Further, it uses the YAML format for its configuration files which allows specifying automation jobs in a manner similar to regular English.

Key features of Ansible

Ansible has an efficient architecture which removes the need for servers, daemons or databases by using “Ansible modules”.

These modules carry the instructions to configure the state of the host system. They are transferred to the hosts over the SSH channels to communicate with machines or execute commands. 

All the machines managed by your Ansible server are stored in simple plain-text files. When you need to add a new machine, you don’t need to face the hassles of an SSL signing or DNS issues.

This makes Ansible scalable without the need for special software being installed on client hosts.

How to install Ansible?

Let’s get right into the installation of Ansible now. We’ll start with the regular process of updating repositories before we begin.

1. Update APT Repositories

Before we begin the tutorial to install Ansible on Ubuntu, we might wish to make sure that we have the latest version of the Ansible package.

To do this, we need to update our default repositories using the apt package management service. Open the terminal on your Ubuntu system and type the following. 

sudo apt update
Sudo Apt Update
Sudo Apt Update

You should see an output similar to this on your screen. Next, we will use the upgrade command in our terminal.

sudo apt upgrade
Sudo Apt Upgrade
Sudo Apt Upgrade

This is what you will see on the terminal screen. Enter ‘Y’ in the command line to proceed with the operation.

Now, this ensures that we will get the latest version of the Ansible package when we commence with the installation on our system.

2. Install Software Properties Common

The Ansible tool requires some prerequisites to work properly on the control node. So we begin by installing the software-properties-common package from our repository. This can be done using the apt command as follows.

sudo apt install software-properties-common
Apt Install Spc
Apt Install Spc

The output seen in the above screenshot confirms that we successfully installed the prerequisite.

3. Add Ansible Repository

Once we finish installing it, we will add the Ansible repository to our system. This is done by using the following command.

sudo apt-add-repository --yes --update ppa:ansible/ansible
Sudo Apt Add Repository
Sudo Apt Add Repository

You should see an output which looks like the screenshot given above. This will add the required repository to your machine.

Note the --update flag used interchangeably with the -u flag in the apt command on Ubuntu is only available on systems running newer distributions of Ubuntu.

Hence, if the distribution on your system is older than Ubuntu 18.04 you need to adjust your script accordingly for this command to work.

3. Install Ansible Package

Now we can proceed to install the Ansible tool on our system with the apt command as shown below.

sudo apt install ansible

This will access the Ansible repository we just added to our system, then proceed to install it on our system. When prompted, press ‘Y’ to proceed with the installation process.

The below screenshot confirms the installation of Ansible on our system.

Sudo Apt Install Ansible
Sudo Apt Install Ansible

Conclusion

Ansible is a powerful tool to automate your system management requirements as an administrator, developer, or IT manager. It has a simple architecture and a fairly low learning curve for new users.

We hope that this tutorial was able to help you install the Ansible tool on your Ubuntu system. If you have any comments, queries or suggestions, feel free to reach us in the comments below.

Leave a Reply

Your email address will not be published. Required fields are marked *

close
Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages