How to Install Ansible on Debian 10

Install Ansible on Debian 10

In this article, we will have explained the necessary steps to install and set up Ansible on Debian 10. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Ansible is a free and open-source Configuration and automation tool for UNIX-like operating systems. It is written in python and similar to Chef or Puppet but there is one difference and the advantage of Ansible is that we don’t need to install any agent on the nodes. It uses SSH for making communication to its nodes.

Install Ansible on Debian 10

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo apt update
sudo apt upgrade

Step 2. Install Ansible on Debian system.

Now add Ansible APT repository:

echo "deb bionic main" | sudo tee /etc/apt/sources.list.d/ansible.list
sudo apt -y install gnupg2
sudo apt-key adv --keyserver --recv-keys 93C4A3FD7BB9C367

Then, install the latest release of Ansible using the commands below:

sudo apt update
sudo apt install ansible

Now, run the following command to check if Ansible is working correctly:

$ ansible --version
ansible 3.7.8
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/debian/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.16 (default, Mar 08 2021, 01:36:46) [GCC 10.3.0]

Step 3. Configure Ansible.

Edit the Ansible hosts file /etc/ansible/hosts to add the system that we want to manage with Ansible:

sudo nano /etc/ansible/hosts

Add the following:

node1 ansible_ssh_host=

Next, we have to configure an SSH Key for the client node as Ansible is using the SSH protocol to transfer commands to the client system:

ssh-copy-id -i ~/.ssh/ root@

The IP in above command needs to be replaced with the IP address of the system that you want to manage with Ansible.

Now it is time for a first test, log into the other machine by using this SSH command:

ssh root@

Step 4. Test Ansible.

Run this command to test the connection:

ansible -m ping TestClient


node1 | SUCCESS => {
"changed": false, 
"ping": "pong"

That’s all you need to do to install the Ansible on Debian 10 “Buster”. I hope you find this quick tip helpful. For further reading on Ansible, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.