Home  »  ArticlesGuidesHow ToSoftwareTechnologyTools   »   How to Install Ansible in Debian 12 Linux Systems

How to Install Ansible in Debian 12 Linux Systems

Ansible is a popular open-source automation tool used for configuration management, application deployment, and task automation. It is highly favored due to its simplicity and ease of use. In this blog post, we will guide you through the steps to install Ansible on a Debian 12 Linux system.

Prerequisites

Before starting the installation process, ensure that you have:

  • A Debian 12 system up and running
  • A user account with sudo privileges
  • Internet access to download packages

Step 1: Update the System

First, update the package list to ensure you have the latest information on the newest versions of packages and their dependencies.

$ sudo apt update
$ sudo apt upgrade -y

Step 2: Install Required Dependencies

Ansible requires a few dependencies that need to be installed beforehand. These include software-properties-common, python3, and python3-pip.

$ sudo apt install software-properties-common python3 python3-pip -y

Step 3: Add Ansible PPA Repository

Ansible can be installed from the official Debian repositories, but the version might be outdated. To get the latest version, add the official Ansible PPA (Personal Package Archive).

$ sudo apt-add-repository --yes --update ppa:ansible/ansible

Step 4: Install Ansible

With the repository added, you can now install Ansible using the apt package manager.

$ sudo apt update
$ sudo apt install ansible -y

Step 5: Verify the Installation

To confirm that Ansible is installed correctly, check its version. This command will display the installed version of Ansible.

$ ansible --version

You should see output similar to the following, indicating the installed version of Ansible:

ansible [core 2.10.7]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 3.9.2 (default, Feb 19 2021, 17:13:28) [GCC 10.2.1 20210110]

Step 6: Configure Ansible (Optional)

Ansible’s configuration file is located at /etc/ansible/ansible.cfg. You can edit this file to configure global settings for Ansible. However, for most users, the default configuration is sufficient to get started.

$ sudo nano /etc/ansible/ansible.cfg

Make any necessary changes and save the file.

Conclusion

You have successfully installed Ansible on your Debian 12 system. You can now start creating playbooks and automating your IT tasks. Ansible’s powerful and simple automation capabilities will greatly enhance your productivity.

For more detailed information and advanced configurations, refer to the official Ansible documentation.

Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post.