How to install Ansible in the latest Ubuntu 22.04.

Today we're going to talk about the easier way to install and maintain Ansible inside Ubuntu 22.04 with the distribution tools.

I'm Luca Berton and welcome to today's episode of Ansible Pilot.

How to install Ansible in Ubuntu 22.04

  • universe
  • PPA

Today we're talking about how to install Ansible in Ubuntu 22.04 LTS Jammy Jellyfish.

We're going to see the easy way to install and maintain Ansible inside Ubuntu with the distribution tools.

We are going to see how to install Ansible in two different ways.

The first method to install Ansible is using the universe repository, the default that you get after installation.

The main advantage of using the universe repository is that you don't require any external repository.

And the second method to install Ansible is using the PPA repository. Please bear in mind that adding an additional repository has a different quality assurance of software.

See also:

[Ansible terminology - ansible vs ansible-core packages](/articles/ansible-terminology-ansible-vs-ansible-core-packages).

Links

  • [ansible packages for Ubuntu](https://packages.ubuntu.com/search?keywords=ansible)
  • [ansible PPA for Ubuntu](https://launchpad.net/~ansible/+archive/ubuntu/ansible)

Playbook

How to install Ansible in Ubuntu 22.04 LTS Jammy Jellyfish with universe and PPA repositories.

universe

  • code

``bash

#!/bin/bash

sudo apt update

sudo apt install ansible

`

  • execution

``bash

$ ssh [email protected]

Welcome to Ubuntu 22.04 LTS (GNU/Linux 5.15.0-25-generic x86_64)

* Documentation: https://help.ubuntu.com

* Management: https://landscape.canonical.com

* Support: https://ubuntu.com/advantage

System information as of Mon May 2 13:59:01 UTC 2022

System load: 0.07861328125 Processes: 96

Usage of /: 7.1% of 39.86GB Users logged in: 0

Memory usage: 22% IPv4 address for enp0s3: 10.0.2.15

Swap usage: 0% IPv4 address for enp0s8: 192.168.43.7

20 updates can be applied immediately.

16 of these updates are standard security updates.

To see these additional updates run: apt list --upgradable

Failed to connect to https://changelogs.ubuntu.com/meta-release-lts. Check your Internet connection or proxy settings

Last login: Mon May 2 13:50:17 2022 from 192.168.43.5

$ sudo su

root@ubuntu:/home/devops# cat /etc/os-release

PRETTY_NAME="Ubuntu 22.04 LTS"

NAME="Ubuntu"

VERSION_ID="22.04"

VERSION="22.04 (Jammy Jellyfish)"

VERSION_CODENAME=jammy

ID=ubuntu

ID_LIKE=debian

HOME_URL="https://www.ubuntu.com/"

SUPPORT_URL="https://help.ubuntu.com/"

BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"

PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"

UBUNTU_CODENAME=jammy

root@ubuntu:/home/devops# apt-get install ansible

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

The following additional packages