How to install Ansible in the latest Ubuntu 23.04.
Today we’re going to talk about the easier way to install and maintain Ansible inside Ubuntu 23.04 with the distribution tools. I’m Luca Berton and welcome to today’s episode of Ansible Pilot.
How to install Ansible in Ubuntu 23.04
- universe
- PPA
Today we’re talking about how to install Ansible in Ubuntu 23.04 Lunar Lobster. 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.
Links
Playbook
How to install Ansible in Ubuntu 23.04 Lunar Lobster with universe and PPA repositories.
universe
- code
#!/bin/bash
sudo apt update
sudo apt install ansible
- execution
$ ssh [email protected]
Welcome to Ubuntu 23.04 (GNU/Linux 6.2.0-20-generic aarch64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Tue Apr 25 02:40:36 PM UTC 2023
System load: 0.11 Processes: 255
Usage of /: 31.5% of 9.75GB Users logged in: 0
Memory usage: 6% IPv4 address for ens160: 192.168.246.131
Swap usage: 0%
2 updates can be applied immediately.
To see these additional updates run: apt list --upgradable
Last login: Tue Apr 25 13:54:34 2023 from 192.168.246.1
luca@luca:~$ sudo su
[sudo] password for luca:
root@luca:/home/luca# cat /etc/os-release
PRETTY_NAME="Ubuntu 23.04"
NAME="Ubuntu"
VERSION_ID="23.04"
VERSION="23.04 (Lunar Lobster)"
VERSION_CODENAME=lunar
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=lunar
LOGO=ubuntu-logo
root@luca:/home/luca# apt-get install ansible
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
cowsay sshpass
The following NEW packages will be installed:
ansible
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 15.8 MB of archives.
After this operation, 208 MB of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports lunar/universe arm64 ansible all 7.2.0+dfsg-2 [15.8 MB]
Fetched 15.8 MB in 3s (5,213 kB/s)
Selecting previously unselected package ansible.
(Reading database ... 81339 files and directories currently installed.)
Preparing to unpack .../ansible_7.2.0+dfsg-2_all.deb ...
Unpacking ansible (7.2.0+dfsg-2) ...
Setting up ansible (7.2.0+dfsg-2) ...
Processing triggers for man-db (2.11.2-1) ...
Scanning processes...
Scanning processor microcode...
Scanning linux images...
Running kernel seems to be up-to-date.
Failed to check for processor microcode upgrades.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
root@luca:/home/luca# ansible --version
ansible [core 2.14.2]
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
root@luca:/home/luca#
PPA
- code
#!/bin/bash
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt remove ansible
sudo apt install ansible-core
- execution
root@luca:/home/luca# apt update
Hit:1 http://ports.ubuntu.com/ubuntu-ports lunar InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports lunar-updates InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports lunar-backports InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports lunar-security InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@luca:/home/luca# add-apt-repository --yes --update ppa:ansible/ansible
Repository: 'deb https://ppa.launchpadcontent.net/ansible/ansible/ubuntu/ lunar main'
Description:
Ansible is a radically simple IT automation platform that makes your applications and systems easier to deploy. Avoid writing scripts or custom code to deploy and update your applications— automate in a language that approaches plain English, using SSH, with no agents to install on remote systems.
http://ansible.com/
If you face any issues while installing Ansible PPA, file an issue here:
https://github.com/ansible-community/ppa/issues
More info: https://launchpad.net/~ansible/+archive/ubuntu/ansible
Adding repository.
Adding deb entry to /etc/apt/sources.list.d/ansible-ubuntu-ansible-lunar.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/ansible-ubuntu-ansible-lunar.list
Adding key to /etc/apt/trusted.gpg.d/ansible-ubuntu-ansible.gpg with fingerprint 6125E2A8C77F2818FB7BD15B93C4A3FD7BB9C367
Hit:1 http://ports.ubuntu.com/ubuntu-ports lunar InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports lunar-updates InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports lunar-backports InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports lunar-security InRelease
Ign:5 https://ppa.launchpadcontent.net/ansible/ansible/ubuntu lunar InRelease
Err:6 https://ppa.launchpadcontent.net/ansible/ansible/ubuntu lunar Release
404 Not Found [IP: 185.125.190.52 443]
Reading package lists... Done
E: The repository 'https://ppa.launchpadcontent.net/ansible/ansible/ubuntu lunar Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
root@luca:/home/luca# apt remove ansible
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package 'ansible' is not installed, so not removed
The following packages were automatically installed and are no longer required:
ieee-data python3-argcomplete python3-dnspython python3-jmespath
python3-kerberos python3-libcloud python3-lockfile python3-netaddr
python3-ntlm-auth python3-packaging python3-pycryptodome
python3-requests-kerberos python3-requests-ntlm python3-requests-toolbelt
python3-resolvelib python3-selinux python3-simplejson python3-winrm
python3-xmltodict
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
root@luca:/home/luca# apt install ansible
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
ansible-core
Suggested packages:
cowsay sshpass
The following NEW packages will be installed:
ansible ansible-core
0 upgraded, 2 newly installed, 0 to remove and 2 not upgraded.
Need to get 1,288 kB/17.1 MB of archives.
After this operation, 216 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ports.ubuntu.com/ubuntu-ports lunar/universe arm64 ansible-core all 2.14.2-1 [1,288 kB]
Fetched 1,288 kB in 1s (1,306 kB/s)
Selecting previously unselected package ansible-core.
(Reading database ... 80144 files and directories currently installed.)
Preparing to unpack .../ansible-core_2.14.2-1_all.deb ...
Unpacking ansible-core (2.14.2-1) ...
Selecting previously unselected package ansible.
Preparing to unpack .../ansible_7.2.0+dfsg-2_all.deb ...
Unpacking ansible (7.2.0+dfsg-2) ...
Setting up ansible-core (2.14.2-1) ...
Setting up ansible (7.2.0+dfsg-2) ...
Processing triggers for man-db (2.11.2-1) ...
Scanning processes...
Scanning processor microcode...
Scanning linux images...
Running kernel seems to be up-to-date.
Failed to check for processor microcode upgrades.
No services need to be restarted.
No containers need to be restarted.
No user sessions are running outdated binaries.
No VM guests are running outdated hypervisor (qemu) binaries on this host.
root@luca:/home/luca# ansible --version
ansible [core 2.14.2]
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
root@luca:/home/luca#
Conclusion
Now you know how to install ansible using universe and PPA repositories in Ubuntu 23.04 Lunar Lobster. Subscribe to the YouTube channel, Medium, and Website, X (formerly Twitter) to not miss the next episode of the Ansible Pilot.
Academy
Learn the Ansible automation technology with some real-life examples in my Udemy 300+ Lessons Video Course.
My book Ansible By Examples: 200+ Automation Examples For Linux and Windows System Administrator and DevOps
Donate
Want to keep this project going? Please donate