Ansible is an open-source tool by Red Hat. It helps to configure, provision, deploy and manage your system infrastructure across without facing any hassle.
Ansible is agentless and requires no extra software with it. It can connect via SSH, remote PowerShell, and with remote APIs. It also uses a human-readable language, YAML so that one can easily adapt Ansible.
How to install Ansible on Linux
In this first article on Ansible, you’ll learn about installing Ansible on various Linux distributions.
Personally, I prefer to get system information before installing any kind of software. Because It may help you in many aspects for different versions of an operating system.
Use this command to get the information about your Linux distributions and its version number.
It’s output should be something like this:
Once you have made sure which distribution you are using, you can follow the rest of the tutorial to install Ansible.
Installing Ansible on Ubuntu and other Debian-based Linux distributions
Ansible is normally found in the default repositories of Ubuntu and Debian. You can use the command below to install it:
sudo apt install ansible
If Ansible package cannot be found, you can add the project’s PPA (personal package archive) to your system. You can add ansible PPA by using the following command:
sudo apt-add-repository ppa:ansible/ansible
and it’s output:
As you have added a new software source, you have to update your system to get packages available in the PPA. Update the software
sudo apt update
Finally, you can install Ansible using this command:
sudo apt install ansible
After successful completion of the above command, Ansible will be installed on your system.
You should verify the installation by checking the version of Ansible you just installed:
Installing Ansible on CentOS, Red Hat, Fedora, SUSE etc
To install the latest version on ansible in CentOS 7, you should install EPEL (Extra Packages for Enterprise Linux) first using the below command:
sudo yum install epel-release
Then you can easily install Ansible using this command:
sudo yum install ansible
You can check Anisble version using this command:
and its output
How to uninstall Ansible
If you want to uninstall Ansible for some reasons, you can easily do that.
Uninstall Ansible from Ubuntu/Debian
You can uninstall or remove ansible from ubuntu. Use this command:
sudo apt remove ansible
But if you want to remove ansible along with its all dependency packages. Use this command:
sudo apt purge ansible
Uninstall Ansible from CentOS/Red Hat
You can uninstall or remove ansible from CentOS using this command:
sudo yum remove ansible -y
In the next article, I will cover how to connect and access several machines through SSH connection establishment using ansible. Stay tuned for the Ansible