Installing Ansible on Debian 12#

Ansible is a great tool for automating tasks on multiple servers. It is easy to learn and use and it is very powerful. Ansible is written in Python and it uses SSH to connect to the servers or devices you want to manage like routers, switches, etc. There needs to be a central server where Ansible is installed and from there you can manage all your servers or devices.

In this post, we will create that central server and install Ansible on Debian 12 “bookworm” from the official Debian repositories. The first step is to update the system to the latest packages so that we can install Ansible from the official Debian repositories.

Update Debian 12 to the latest packages#
$ sudo apt update
$ sudo apt upgrade -y

The next step is to install Ansible on Debian 12 and we can do that with the following command so that we can manage our servers or devices. The Ansible package will install all the dependencies needed to run Ansible on Debian 12, but in some cases you might need to install additional packages depending on your needs.

Install Ansible on Debian 12#
$ sudo apt install -y ansible

Now that Ansible is installed on Debian 12, we can check the version of Ansible to make sure that it is installed correctly.

Check Ansible version#
$ ansible --version
ansible [core 2.14.3]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/sysadmin/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/sysadmin/.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

As you can see, Ansible is installed on Debian 12 and we can start using it to manage our servers or devices.