Install Ansible on CentOS / Red Hat / Ubuntu / Debian

How does Ansible work?

Ansible translates Ansible playbooks into commands that are run over SSH, which has several benefits when it comes to managing Unix-like environments:

  1. Most, if not all of the Unix-like machines you are administering will have SSH running by default.
  2. Relying on SSH means that no agent is required on the remote host.
  3. In most cases no additional software needs to be installed as Ansible requires Python 2.6 in order to operate. Most, if not all distributions of Linux have this version (or greater) installed by default.
  4. Ansible does not require a master node. It can be run from any host that has the Ansible package installed and sufficient SSH access.
  5. Although running Ansible in a cron job is possible, by default Ansible only runs when you tell it to.

Installing Ansible

The installation of the Ansible package is only required on the host that generated the SSH key.

If you run CentOS or Red Hat, you need to configure Extra Packages for Enterprise Linux (EPEL) repositories :

sudo yum install epel-release -y

Then you can install Ansible with yum :

sudo yum install ansible -y

For Ubuntu / debian based systems, you can install Ansible from the PPA :

sudo apt-get install software-properties-common -y 
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update
sudo apt-get install ansible -y

Now you can check Ansible version :

it will show ansible version & default python version also.

Thank you for reading this article.

Was this helpful?

0 / 0

Leave a Reply 1

Your email address will not be published. Required fields are marked *



This is very interesting, You’re a very skilled blogger. I have joined your feed and look forward to seeking more of your great post. Also, I have shared your website in my social networks!