Ansible on Ubuntu
How To

Install Ansible on Ubuntu

Sagar Sharma
Sagar Sharma

Table of Contents

If you are looking for a way to automate the application deployment process, cloud instances, VMs, containers, and more, ansible will reduce the complexity in half!

And because the configuration file is written in plain English, so no stiff learning curve there!

So in this tutorial, I will walk you through how you can install ansible on ubuntu using the default repository and will also include a way to install the most recent version of ansible on Ubuntu.

How to install Ansible in Ubuntu

There are two ways of installing ansible on Ubuntu:

  • Using default repository.
  • Using PPA (gets the latest version).

The default repository will get you a slightly older package. While writing, the default repository will get you ansible version 2.10.8.

And if you utilize PPA, you will get ansible version 2.13.7.

Install Ansible using the default repository in Ubuntu

The installation process will be straightforward as you'll be using the default repository for installation.

As the package can be installed using the single command:

sudo apt install ansible

Once you are done with the installation, you can use the following command to check the installed version:

ansible --version
check ansible installed version in ubuntu

Install the latest version of Ansible on Ubuntu

If you are looking for the latest version of ansible, you'd have to use PPA for the installation.

Use the following command to add ansible PPA:

sudo apt-add-repository ppa:ansible/ansible

Now, to take effect from added PPA, update the repositories:

sudo apt update

And now, you can use the following command to install ansible:

sudo apt install ansible

That's it, you have the most recent release of ansible. Wanna check the version no? Here's how you do it:

ansible --version
install the latest version of ansible

How to uninstall Ansible from Ubuntu

If you no longer want ansible in your system you can easily remove that package from ubuntu using the following command:

sudo apt remove ansible

And if you want to remove all the binaries and data, you can use the purge command:

sudo apt purge ansible 

That should do it.

But what about PPA? Well, here's a quick command to remove ansible PPA from your system:

sudo rm -i /etc/apt/sources.list.d/ansible-ubuntu-ansible-jammy.list

And if you want to learn more, we have a detailed guide on how you can remove PPA from your system.

Wrapping Up

This was a quick tutorial on how you can install ansible on ubuntu including a way to get the most recent version.

Why do you use ansible? I'm just curious!