Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Debian 12 - Install Ansible

This brief tutorial provides you instructions on how to install Ansible on Debian 12 systems for if you wanted to control other systems, as well as how to install the base packages for if you just want your Debian 12 system to be managed by an Ansible controller.

Controller Install Methods

Choose one of the two following methods to install Ansible for if you wish to control use ansible to manage other systems.

1. Use Local Repostitories (Recommended)

The simplest (recommended) installation method is to run:

sudo apt-get install ansible -y

This will install ansible core version 2.14.18, using python 3.11.2 at the time of writing this.

2. Pipx Method

Alternatively you can install from source to get a more recent version: 2.18.1.

sudo apt install pipx -y
pipx install --include-deps ansible

Updating PATH Variable

This will install ansible to the running users $HOME/.local/pipx area, whilst creating symlinks in your $HOME/.local/bin It will warn you if this path is not part of your $PATH variable, in which case you can manually include it by editing your $PATH in your .bashrc file, or you can run the following:

pipx ensurepath

... which does this for you.

BASH Completions

You may also with to run the following to install BASH completions for pipx

eval "$(register-python-argcomplete pipx)"

Controlled System Base Installation

If you only need your Debian 12 system to be controlled by another system that acts as your Ansible controller, then you only need to install the ansible-core package with:

sudo apt update && sudo apt install ansible-core -y

You generally do not need to install ansible on the servers to be controlled.

References

Last updated: 20th January 2025
First published: 19th January 2025

This blog is created by Stuart Page

I'm a freelance web developer and technology consultant based in Surrey, UK, with over 10 years experience in web development, DevOps, Linux Administration, and IT solutions.

Need support with your infrastructure or web services?

Get in touch