Linux Mint

How to Install and Configure Ansible on Linux Mint 21

Ansible is an open-source platform for automating and managing IT infrastructure and applications. It is used to configure, deploy, and manage servers, networks, and other systems in a consistent way. Read this guide if you are planning to use Ansible on Linux Mint 21 as it explains its installation and configuration in a detailed manner.

How to Install Ansible on Linux Mint 21

Ansible is popular among system administrators and IT professionals because it is easy to use and can help automate many routine tasks. The process for installing Ansible is easy to follow so here are some necessary steps for installing Ansible on Linux Mint 21:

Step 1: First install all the required dependencies to run Ansible successfully on Linux Mint by executing:

$ sudo apt install software-properties-common -y

Step 2: Next, execute the given command to install it through the apt package manager on Linux Mint 21:

$ sudo apt install ansible

Now to confirm the installation on Ansible let’s check the version of it by using:

$ ansible --version

How to Configure Ansible on Linux Mint 21

Once the installation is complete now it’s time to configure Ansible to make it usable on Linux Mint and for that go through the subsequent steps:

Step 1: First install the secure shell server on Linux Mint that is used to securely connect to and manage remote systems over a network so execute:

$ sudo apt install openssh-server -y

Next to see if it is running or not check the status of ssh on Linux Mint by executing:

$ sudo systemctl status sshd

Step 2: Next, to ensure proper functionality of ssh allow it through the firewall of Linux and for that use:

$ sudo ufw allow ssh

Step 3: Now create a user; enter his/her details like name and phone number, below is the syntax to create a user:

$ sudo adduser <user-name>

In my case I have named it as “ansibleuser”:

$ sudo adduser ansibleuser

Step 4: Now allow all ansible users to have password access to Ansible and for that edit the ansible file by adding “ansible ALL=(ALL) NOPASSWD:ALL” using:

$ echo "ansible ALL=(ALL) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/ansible

Step 5: Next, to generate the ssh keys through the key generator in Linux Mint:

$ ssh-keygen

Step 6: Now copy the public version of ssh key to the host you want to give access and for that follow the given below syntax:

$ ssh-copy-id ansible@<host-IP-address>

Here in my case the IP address of the host is so I have copied the public to that IP using the above given syntax:

$ ssh-copy-id ansible@

Step 7: Now, open the host file to add the IP addresses of the host for Ansible and for that execute:

$ nano hosts

Now enter the IP address of the hosts you want to give access, here in my case its only one host so I have given only one IP, once you are done with entering the IP close the file after saving it:

Step 8: Now let’s check if the Ansible is working, for that pin the any of the user you have created by following the below syntax:

$ ansible all -i ./hosts -u <created-user-name> -m ping

Since I created a user named ansibleuser so I ping the ansibleuser by following the above-mentioned syntax:

$ ansible all -i ./hosts -u ansibleuser -m ping

Removing Ansible from Linux Mint 21

If you no longer going to use Ansible and want to remove it completely from your Linux Mint, then execute:

$ sudo apt remove --autoremove ansible -y


Ansible is designed to be easy to use and learn, and it uses a simple, declarative language for expressing tasks and configurations. It is also highly scalable and can be used to manage large and complex IT environments. On Linux Mint 21 Ansible can be installed through its default package manager, this guide discusses the process of installing and configuring it.

About the author

Aaliyan Javaid

I am an electrical engineer and a technical blogger. My keen interest in embedded systems has led me to write and share my knowledge about them.