• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
sharadchhetri.com

sharadchhetri.com

Linux,Cloud Computing And DevOps

  • Home
  • Linux
  • CloudComputing
    • Introduction Cloud Computing
    • Amazon AWS
  • Free E-Books
  • About Me

Install Ansible on Ubuntu / CentOS / RHEL

July 19, 2015 by Sharad Chhetri Leave a Comment

In our first post on Ansible, we will learn how to install Ansible on Ubuntu / CentOS / RHEL . In the world of IT automation tools, Ansible name is famous among system admins and developers. Ansible can be used in cloud provisioning, configuration management, application deployment, intra-service orchestration and other automation needs.

Features of Ansible

We tried to place some basic features of Ansible here so that in first step everything should look simple and not confused .

1. Ansible is agentless and use SSH to connect with client machine.
2. Ansible configuration files uses the YAML format.
3. Ansible runs with its module library and orchestrate the multiple nodes exist in network.
4. Ansible knows about the host address information through its inventory file.

NOTE: Here, we are describing installation of anisible in 3 different section. Hence, select the section as per your Operating system and best suited for you.

Install Ansible with pip on Ubuntu / CentOS / RHEL

I personally like to go with pip installation method because we have to create complete Ansible file hierarchy from scratch.

(A) First install pip into your system. Read our previous post on – How to install pip on CentOS / RHEL / Ubuntu / Debian, where you will find installing pip in various Operating System versions.

(B) Installing ansible with pip command.

On CentOS / RHEL / Ubuntu / Debian , use below command to install Ansible via pip.

sudo pip install ansible

Install Ansible on Ubuntu with apt-get command

To install latest Ansible on Ubuntu system, use the below given command.

In Ubuntu 14.04 LTS or below

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

In Ubuntu 16.04 LTS or above

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

After installation, the /etc/ansible will be created and have two files i.e anisible.cfg and hosts .
Given below is reference from our system.

sharad@ubuntu:~$ ls -l /etc/ansible/
total 16
-rw-r--r-- 1 root root 8629 Jun 26 05:55 ansible.cfg
-rw-r--r-- 1 root root  965 Jun 26 05:55 hosts
sharad@ubuntu:~$

Install Ansible on CentOS / RHEL

To install Ansible on CentOS/RHEL , first you have to install EPEL repo into your system.

1. For CentOS 7 / RHEL 7 : Install EPEL repo on CentOS 7 and RHEL 7
2. For CentOS 6.x, 5.x / RHEL 6.x, 5.x : Install EPEL repo in CentOS 5.x , 6.x / RHEL 5.x, 6.x / Scientific Linux

Once you install the EPEL repo, you only have to hit the command –

sudo yum install ansible

After installation, you will see 2 files and 1 directory inside /etc/ansible .

See given below reference from our system .

[root@localhost ~]# ls -lhrt /etc/ansible/
total 16K
drwxr-xr-x 2 root root    6 Jun 25 17:11 roles
-rw-r--r-- 1 root root  965 Jun 25 17:11 hosts
-rw-r--r-- 1 root root 8.5K Jun 25 17:11 ansible.cfg
[root@localhost ~]#


FAQ

Here, in this section we will cover frequently asked question which you may be thinking about.

1. In this post, we have seen hosts file. What is it ?
Answer : This is Ansible inventory file. by default, it comes with examples hence suggest to take the backup and create your own new hosts file inside /etc/ansible.

2. In this post, we have found also found ansible.cfg file. What it do ?
Answer : It is comprised of ansible variables . Hence, we suggest you to read the commented and uncommented ansible variables written in this file.

3. In CentOS / RHEL ansible installation, what this roles directory do ?
Answer: By defaulr this roles directory is empty . But here, we can define the ansible role. You have to read our upcoming ansible tutorials where we will also write about ansible roles and playbooks.

Do'nt be greedy, share the knowledge!

  • Click to share on Facebook (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
  • Click to share on Reddit (Opens in new window)
  • Click to share on Pocket (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)

Related

Filed Under: Linux Tagged With: ansible

Reader Interactions

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Follow Us

  • Facebook
  • Twitter
  • GitHub
  • YouTube

Recent Posts

  • How to install Java (OpenJDK) on Ubuntu Linux
  • How to install Groovy on Ubuntu 20.04 LTS
  • How to Disable selinux in Red Hat or CentOS
  • How to remove date from WordPress Post URL
  • How to install Mariadb 10.4 server on CentOS 8 / RHEL 8

Top Posts & Pages

  • How to delete mail queue in Postfix
  • How to start / stop / restart / reload iptables on CentOS 7 / RHEL 7
  • How to set hostname and FQDN on CentOS 7 and RHEL 7
  • How to install MySQL Server 5.6 on CentOS 7 / RHEL 7
  • How to fix read only USB pen drive in Ubuntu
  • How to create Jenkins user by command line and GUI
  • How to setup Jenkins Credentials for Git repo access
  • How to find absolute path of command on Linux / Unix : which command
  • make command not found in linux CentOS Red Hat ubuntu Debian
  • 4 different commands to check the load average in linux

DevOps Posts

  • vagrant cloud flow

    Install Vagrant on Ubuntu and create first VM

  • git jenkins credential github

    How to setup Jenkins Credentials for Git repo access

  • terraform

    how to install terraform in Linux : CentOS-Ubuntu

  • docker image

    How to create Ubuntu docker base image

  • Install Ansible on Ubuntu / CentOS / RHEL

Footer

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Sharad Chhetri is an experienced Linux - Cloud Engineer & freelancer. Working on Open Source Technology since RHEL 4.0 (Red Hat Enterprise Linux). He loves sharing the knowledge which earned from real scenarios. Don't be surprised if you find him in technology seminars and meetup groups. You can contact him on email for freelance projects at admin@sharadchhetri.com. Read More…

Tags

Amazon AWS apache automation awk bash script CentOS centos 7 debian devops docker freebsd ftp ghost git grep hostname jenkins kvm linux linux command linux commands MariaDB Server mysql Nagios nginx Octopress owncloud Owncloud 6 php postfix postgres python Red Hat rpm sed selinux ssh swap ubuntu user management vagrant varnish virtualbox vsftp wordpress

Recent Comments

  • Ali on How to delete mail queue in Postfix
  • Mehar on How to install Java (OpenJDK) on Ubuntu Linux
  • Ramone Burrell on How to fix read only USB pen drive in Ubuntu
  • Pera on How to fix read only USB pen drive in Ubuntu
  • Ubuntu on How to fix read only USB pen drive in Ubuntu
  • Nitin Sharma on Install and configure rsyslog Centralized logging server in CentOS 6.5
  • Sharad Chhetri on Install and configure rsyslog Centralized logging server in CentOS 6.5
  • nitin on Install and configure rsyslog Centralized logging server in CentOS 6.5

Copyright © 2009 - 2021 · All Rights Reserved sharadchhetri.com · · Privacy Policy ·
· sitemap.xml · ·The content is copyrighted to sharadchhetri.com and may not be reproduced on other websites without our permission. ·

Copyright © 2021 · Genesis Sample on Genesis Framework · WordPress · Log in