Skip to main content
Raspberry PiRH294

Installing Ansible on the Raspberry Pi

By January 22, 2020September 12th, 2022No Comments

In this blog we look at the steps that you need to take in Installing Ansible on the Raspberry Pi. The RPi will be running the Debian based Raspbian distribution.

So you have a Raspberry Pi — what are you going to do with it! Installing Ansible on the Raspberry Pi is simple where we do not need the latest version but we probably do. Ansible, itself, is a configuration management system that is agentless, so we only need to install Ansible on the controller which is often a desktop system. This makes the Raspberry Pi a good target to use as the controller, especially if we don’t need to manage too many systems.

$ sudo apt update
$ sudo apt install -y ansible sshpass

If we install directly from the Rasbian repositories we will get an earlier version of Ansible, 2.2.1 as of January, 2020. When Installing Ansible on the Raspberry Pi we probably want a later version especially if we want to also use this in learning Ansible for the RHCE certification from Red Hat which is now based on Ansible. Having the earlier version installed is not an issue as when we have the latest version available we can update the package.

Checking in the Ansible website, where they have excellent documentation, https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-ansible-on-debian we can see that we add a Ubuntu PPA, Personal Package Archive for Debian. We can edit the file /etc/apt/sources.list and add a new line:

$ echo "deb http://ppa.launchpad.net/ansible/ansible/ubuntu trusty main" | sudo tee -a /etc/apt/sources.list

With the new repository installed we will need to grab the GPG signing key from Ubuntu, to do this we need to to add the GPG Directory Manager to manage the download.

$ sudo apt install dirmngr -y

We can now install the key:

$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 93C4A3FD7BB9C367

With the key installed we can then run the update again before installing he later version of Ansible:

$ sudo apt update
$ sudo apt install -y ansible

We will now have a later version direct from Ansible. We can check the version we have 2.9.4 as of January 2020:

$ ansible --version

Installing Ansible on the Raspberry Pi is shown in detail with the following video