How Can We Help?

How to Install Ansible on Ubuntu

You are here:
< All Topics

The procedure for installing Ansible on Ubuntu versions 18.04, 20.04, and 22.04 LTS is as follows

 

 

First, remove the default version supplied by the official Ubuntu repository:

 

sudo apt remove ansible
sudo apt –purge autoremove

 

Next, update the Ubuntu repository and apply all current patches:

 

sudo apt update
sudo apt upgrade

 

Then install the software-properties-common package on Ubuntu and enable PPA support for the ansible repository:

 

sudo apt -y install software-properties-common
sudo apt-add-repository ppa:ansible/ansible

 

Next install the latest version of Ansible for Ubuntu:

 

sudo apt install ansible

 

 

Finally, set up Ansible bash completion support:

sudo apt install python3-argcomplete
sudo activate-global-python-argcomplete3

 

 

You should now be able to run ansible-playbook and other ansible commands.

 

 

 

Tags:
Table of Contents