Ubuntu – Installing Ansible 2.9 on Ubuntu 21.04

ansibleUbuntu

Is it possible to install Ansible 2.9 on Ubuntu 21.04 via apt?

Apt on Ubuntu 21.04 installs Ansible 2.10 by default, and playbooks written for Ansible 2.9 do not always work well on Ansible 2.10.

The command

apt install -y ansible=2.9.*

doesn't work on Ubuntu 21.04, even if I add the ppa:ansible/ansible repository as recommended by the Ansible docs.

Best Answer

Even though Ansible 2.10 is the release that split modules out as collections, your prior playbooks should still work.

The ansible package bundles the previous modules and plugins. Short names from 2.9 are aliased to the fully qualified collection names.

2.10 Porting Guide contains behavior changes from 2.9 to 2.10. Undocumented behavior changes are bugs, please file an issue in that collection's issue tracker, a link is on that collection's Ansible Galaxy listing.


To stay on 2.9 for a while longer, consider uninstalling the deb packages and installing from pip. Even though I like OS package management for everything, convenient to use pip to install whatever version in my home directory or a virtualenv, and avoid getting clever with apt.

As of July 2021, both Debian packaging of ansible and Ansible's PPA lag behind the official pip package. The latter of which is currently at version 4.2. Choose what package you want, but keep in mind that all third party packages are lagging.