DevOps

How to Install Ansible on Ubuntu and Other Linux Distributions

Learn to install Ansible on Linux in clear and precise steps. The tutorial is valid for Ubuntu, Debian, CentOS, Red Hat, SUSE etc.

Community
Community

These days, Ansible is a big buzzword in the IT industry. It is a radical automation DevOps tool for IT orchestration.

Ansible is an open-source tool by Red Hat. It helps to configure, provision, deploy and manage your system infrastructure across without facing any hassle.

Ansible is agentless and requires no extra software with it. It can connect via SSH, remote PowerShell, and with remote APIs. It also uses a human-readable language, YAML so that one can easily adapt Ansible.

You have everything you need for your system automation in a complete package through Ansible.

How to install Ansible on Linux

In this first article on Ansible, you’ll learn about installing Ansible on various Linux distributions.

Personally, I prefer to get system information before installing any kind of software. Because It may help you in many aspects for different versions of an operating system.

Installing Ansible on Ubuntu and other Debian-based Linux distributions

Ansible is normally found in the default repositories of Ubuntu and Debian. You can use the command below to install it:

sudo apt install ansible

If Ansible package cannot be found, you can add the project’s PPA (personal package archive) to your system. You can add Ansible PPA by using the following command:

sudo apt-add-repository ppa:ansible/ansible

As you have added a new software source, you have to update your system to get packages available in the PPA. Update the software repositories list with this command:

sudo apt update

Finally, you can install Ansible using this command:

sudo apt install ansible

After successful completion of the above command, Ansible will be installed on your system.

You should verify the installation by checking the version of Ansible you just installed:

ansible --version

Installing Ansible on CentOS, Red Hat, Fedora, SUSE etc

To install the latest version on Ansible in CentOS , you should install EPEL (Extra Packages for Enterprise Linux) first using the below command:

sudo yum install epel-release

Then you can easily install Ansible using this command:

sudo yum install ansible

You can check Ansible version using this command:

ansible --version

and its output

Check Ansible version on Linux

How to uninstall Ansible

If you want to uninstall Ansible for some reasons, you can easily do that.

Uninstall Ansible from Ubuntu/Debian

You can uninstall or remove Ansible from Ubuntu. Use this command:

sudo apt remove ansible

But if you want to remove Ansible along with its all dependency packages. Use this command:

sudo apt purge ansible

Uninstall Ansible from CentOS/Red Hat

You can uninstall or remove Ansible from CentOS using this command:

sudo yum remove ansible -y

In the next article, I will cover how to connect and access several machines through SSH connection establishment using Ansible. Stay tuned for the Ansible tutorial series.



Join the conversation.