Setting up Ansible on Linux-based servers

Ansible is an extremely user-friendly IT automation platform that makes your applications and systems easier to deploy. It can be used to automate cloud provisioning, manage configuration and deploy software. By using Ansible, you can avoid writing scripts or custom code to set up and update your applications.

Ansible is built to be an easy-to-use, versatile and remarkably secure tool. It is fit for any kind of environment, ranging from small setups with few instances to enterprise environments with thousands of instances. It has a simple setup process and a minimal learning curve and aims to describe infrastructure in a language easily processed by both humans and machines.

In this tutorial, you will learn how to set up Ansible on different Linux distributions. By following the steps below, you will get it up and running in no time.

On Ubuntu:

Ubuntu users must install PPA before installing Ansible on their machines:

# sudo apt-get install software-properties-common

# sudo apt-add-repository ppa:ansible/ansible

# sudo apt-get update

# sudo apt-get install ansible

On Debian:

  • Same as on Ubuntu, as a Debian user you must first install PPA.
  • Once that’s done, open the file at /etc/apt/sources.list file and add the following line to it:
deb trusty main
  • Once you’ve saved the changes, go ahead and run:
# sudo apt-key adv --keyserver --recv-keys 93C4A3FD7BB9C367

# sudo apt-get update

# sudo apt-get install ansible

On Red Hat / CentOS / Fedora:

Fedora users can install Ansible directly. CentOS (7) and RHEL users, however, must follow a few steps before they’ve completed the installation.

  • Run these commands:
# wget

# rpm -ivh epel-release-7-9.noarch.rpm
  • Once EPEL has finished installing, enter the following lines:
#yum update

# yum install ansible

And that’s all! You’ve now successfully set up Ansible on your Linux-based machine!

Leave a Reply