Learning Horizon | For Learners

ASP.NET, SQL SERVER, JQUERY,JAVASCRIPT, WEBSPHERE

Monday 23 September 2019

Install Ansible On Redhat Linux 7 System Offline

I have given a task in the team to automate some of the daily operational tasks so that we can increase productivity of the team and department. After some research on google I’ve found ansible. Today, we will learn about how to install ansible on redhat 7 Linux offline (without internet). This tutorial is for all of you folks who don’t have internet access on the target system. I’ve used Red Hat Enterprise Linux 7 (RHEL 7) VM (virtual machine) for this purpose.

What is Ansible?

Ansible is a free automation tool that supports the management of Unix-like and Microsoft Windows system configurations. It helps you use SSH to perform configuration management and deployment software on multiple nodes from one single machine. Also, we can execute the entire operation by a single ansible command. However, in some cases, it may be necessary to perform multiple commands for deployment.

Why We Should Use Ansible?

Because when you use other configuration management tools (such as puppet, chef, and CFEngine), the server software will be installed on one computer, and the client computer will be managed through an agent. In Ansible, nodes are managed by controlling computers via SSH (through Ansible control server), so no agent will run on the node computers. We can use a significant number of ready-made modules for configuration management. Because it's an open-source IT automation tool so, we can write custom modules as well.

OS Support:

Currently, We can run ansible from any machine with Python 2 (version 2.7) or Python 3 (versions 3.5 and higher) installed. It includes Red Hat Linux, Debian, CentOS or Fedora, OS X, Ubuntu, Solaris Arch Linux, Slackware Linux, Clear Linux any of the BSDs. Microsoft Windows is not supported for the control node.

Pre-Requisites to Install Ansible On RHEL 7:

  1. Before installing ansible you should ensure underneath referenced essentials are available on your target system. If not present, you should download beneath RPM’s and make them accessible by replicating on the objective machine in suitable catalog/directory for example installation_media.

I will recommend you install the above RPM’s using yum localinstall command instead of any other rpm command because yum can easily handle any prerequisites needed by these packages.

Pre-Requisite Installation Commands:

yum localinstall -y /installation_media/python-crypto2.6-2.6.1-2.el6.x86_64.rpm
yum localinstall -y /installation_media/python-httplib2-0.7.41.el6.art.noarch.rpm
yum localinstall -y /installation_media/python-jinja2-26-2.6-3.el6.noarch.rpm
yum localinstall -y /installation_media/python-keyczar-0.71c 1.el6.noarch.rpm
yum localinstall -y /installation_media/sshpass-1.05-5.el6.art.x86_64.rpm

Ansible Installation Procedure:

  1. Download Ansible from this URL (https://www.rpmfind.net/linux/rpm2html/search.php?query=ansible ) and copy this rpm to the installation_media catalog/directory on target machine.
  2. Use mentioned command to install ansible. i.e. Yum localinstall /installation_media/ansible*
  3. When above command completed, you can verify that ansible is installed successfully by using command i.e. ansible --version
ansible-version

Ansible Hierarchy:

It's time to explain the ansible file/folder hierarchy. You will notice that if you list files or folders in /etc/ansible, you will see the following. In addition, I have provided a description of each file or folder.

  • /etc/ansible — The ansible home folder where everything resides
  • /etc/ansible/hosts — This file contains information of hosts. You can mention host name their IP's or mention them in the form of groups.
  • /etc/ansible/ansible.cfg — This is the main configuration file for Ansible
  • /etc/ansible/roles — This folder allows you to create folders for each server role, web/db/app, etc.

A rich documentation availability and regular updates of Ansible on it's website makes it a very strong competitor of Puppet and Chef like automation tools. Please write us in the comment section if you have any queries or question regarding this post. In the next article I will talk about how to create or delete user by using ansible playbook.

5 comments:

Please do not enter spam links.