Ansible Installation Steps Red Hat Enterprise Linux 7 (RHEL 7)

Ansible is a simple IT automation engine that automates provisioning, configuration management, application deployment and many other IT needs. Designed for multi-tier deployments, ansible models your IT infrastructure by describing how all of your systems interrelate, rather than just managing one system at a time. In this Article we are going to learn Ansible Installation Steps Red Hat Enterprise Linux 7 – RHEL 7.

It uses no agents and no additional custom security infrastructure, so it’s easy to deploy – and most importantly, it uses a very simple language YAML that allow you to describe your automation jobs in a way that approaches plain English.

Ansible Architecture

Ansible works by connecting to your nodes and pushing out small programs, called “Ansible modules” to them. These programs are written to be resource models of the desired state of the system. Ansible then executes these modules using SSH Protocol, and removes them when finished.

Your library of modules can reside on any machine, and there are no servers, daemons, or databases required. Typically you will work with your favorite terminal program, a text editor, and probably a version control system to keep track of changes to your content.

Ansible Installation RHEL 7

To Install Ansible, we have to configure EPEL Repository then install using this extra repository

# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-10.noarch.rpm
# rpm -ivh epel-release-7-10.noarch.rpm

If your directly trying to install using yum command it will end up with below error

 Required: python-jinja2
 Requires: PyYAML
 Require: python-pyasn1

Why above error is occurring i already configured EPEL repository it contains most of the required RPM’s (typically Python). But recently Red Hat is moved python-jinja2 and PyYAML packages are part of Optional Server repository. To install these you have to subscribe to RHEL. Alternative is download them manually and install.

# yum install python-dev python-pip
# yum install gcc gcc+

Install above packages and verify pip version, Pip version must be 9 or above, if not try upgrade as shown below

[root@ArkIT-Serv ~]# pip --version
pip8.1.2 from /usr/lib/python2.7/site-packages (python 2.7)

# pip install --upgrade pip

Dependencies needs to be resolved manually

# yum install python2-crypto python2-paramiko python-htt*
# wget ftp://195.220.108.108/linux/centos/7.3.1611/os/x86_64/Packages/python-jinja2-2.7.2-2.el7.noarch.rpm
# wget ftp://195.220.108.108/linux/centos/7.3.1611/os/x86_64/Packages/python-babel-0.9.6-8.el7.noarch.rpm
# rpm -ivh python-babel-0.9.6-8.el7.noarch.rpm
# wget ftp://195.220.108.108/linux/centos/7.3.1611/os/x86_64/Packages/python-markupsafe-0.11-10.el7.x86_64.rpm
# rpm -ivh python-markupsafe-0.11-10.el7.x86_64.rpm
# rpm -ivh python-jinja2-2.7.2-2.el7.noarch.rpm
# wget ftp://195.220.108.108/linux/centos/7.3.1611/os/x86_64/Packages/libyaml-0.1.4-11.el7_0.i686.rpm
# rpm -ivh libyaml-0.1.4-11.el7_0.i686.rpm --nodeps

Now Try Ansible installation using pip command 

# yum install ansible

Check ansible installed Version 

[root@ArkIT-Serv ~]# ansible --version
ansible 2.3.2.0
 config file = /etc/ansible/ansible.cfg
 configured module search path = Default w/o overrides
 python version = 2.7.5 (default, Aug 2 2016, 04:20:16) [GCC 4.8.5 20150623 (Red Hat 4.8.5-4)]

That’s it. Ansible Installation Steps RHEL 7 Completed and Installation is successful.

Related Articles

Linux Tutorial

Subversion Server Setup Linux

HowTo configure Linux LVM with Multipath Enabled

Ansible Documentation

Thanks for your wonderful Support and Encouragement

Ravi Kumar Ankam

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

2 Responses

  1. James says:

    Nice article. But pls check ansible config file path is not visible. Correct the installation.

  2. arvind says:

    I’ve encountered the following error:

    [root@ansiblemaster tmp]# ansible –version
    ERROR! Unexpected Exception, this is probably a bug: (cryptography 0.8.2 (/usr/lib64/python2.7/site-packages), Requirement.parse(‘cryptography>=1.1’))
    the full traceback was:

    Traceback (most recent call last):
    File “/usr/bin/ansible”, line 97, in
    mycli = getattr(__import__(“ansible.cli.%s” % sub, fromlist=[myclass]), myclass)
    File “/usr/lib/python2.7/site-packages/ansible/cli/__init__.py”, line 38, in
    from ansible.inventory.manager import InventoryManager
    File “/usr/lib/python2.7/site-packages/ansible/inventory/manager.py”, line 36, in
    from ansible.plugins.loader import inventory_loader
    File “/usr/lib/python2.7/site-packages/ansible/plugins/loader.py”, line 22, in
    from ansible.parsing.utils.yaml import from_yaml
    File “/usr/lib/python2.7/site-packages/ansible/parsing/utils/yaml.py”, line 17, in
    from ansible.parsing.yaml.loader import AnsibleLoader
    File “/usr/lib/python2.7/site-packages/ansible/parsing/yaml/loader.py”, line 30, in
    from ansible.parsing.yaml.constructor import AnsibleConstructor
    File “/usr/lib/python2.7/site-packages/ansible/parsing/yaml/constructor.py”, line 29, in
    from ansible.parsing.vault import VaultLib
    File “/usr/lib/python2.7/site-packages/ansible/parsing/vault/__init__.py”, line 42, in
    from cryptography.hazmat.backends import default_backend
    File “/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/__init__.py”, line 7, in
    import pkg_resources
    File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 3011, in
    parse_requirements(__requires__), Environment()
    File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 630, in resolve
    raise VersionConflict(dist,req) # XXX put more info here
    VersionConflict: (cryptography 0.8.2 (/usr/lib64/python2.7/site-packages), Requirement.parse(‘cryptography>=1.1’))
    [root@ansiblemaster tmp]#

Leave a Reply

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