Automating the administration of our servers has become more important than ever with the exponential growth of our server estate. Using Ansible for automation gives us security, reliability and the need for lesser staff to effectively manage the systems. Moreover, the new RHCE exam from RedHat System Administration 3 is in fact Ansible based recognizing the skills needed for server automation. In this post, we’ll demonstrate how to install Ansible on a system running RHEL 8.

Let’s check if ansible is currently available to us.

[root@linuxnix ~]# yum list ansible
Updating Subscription Management repositories.
Last metadata expiration check: 0:04:15 ago on Mon 19 Aug 2019 06:52:14 AM IST.
Error: No matching Packages to list
[root@linuxnix ~]#

From the above output, we can determine that ansible is currently not available and we will need to enable the required repository in order to install it. To list the repositories available with our subscription we will use the subscription-manager repos command.

[root@linuxnix ~]# subscription-manager repos
Available Repositories in /etc/yum.repos.d/redhat.repo
Repo ID: satellite-tools-6-beta-for-rhel-8-x86_64-source-rpms
Repo Name: Red Hat Satellite Tools 6 Beta (for RHEL 8 x86_64) (Source RPMs)
Repo URL:
Enabled: 0

Repo ID: rhel-8-for-x86_64-appstream-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
Repo URL:$releasever/x86_64/appstream/os
Enabled: 1

Repo ID: rhel-atomic-7-cdk-3.3-debug-rpms
Repo Name: Red Hat Container Development Kit 3.3 /(Debug RPMs)
Repo URL:$basearch/cdk/3.3/debug
Enabled: 0

Repo ID: rhel-8-for-x86_64-appstream-debug-rpms
Repo Name: Red Hat Enterprise Linux 8 for x86_64 - AppStream (Debug RPMs)
Repo URL:$releasever/x86_64/appstream/debug
Enabled: 0

Repo ID: ansible-2.8-for-rhel-8-x86_64-debug-rpms
Repo Name: Red Hat Ansible Engine 2.8 for RHEL 8 x86_64 (Debug RPMs)
Repo URL:
Enabled: 0

---------------------------------------------------------------output truncated for brevity

In the above output we can notice the repository for ansible with the repo id ansible-2-for-rhel-8-x86_64-rpms but it’s not enabled. Now let’s enable the repository that provides ansible with the following command.

[root@linuxnix ~]# subscription-manager repos --enable ansible-2.8-for-rhel-8-x86_64-rpms
Repository 'ansible-2.8-for-rhel-8-x86_64-rpms' is enabled for this system.
[root@linuxnix ~]#

If we run yum list ansible again we will see that it’s available for installation.

[root@linuxnix ~]# yum list ansible
Updating Subscription Management repositories.
Red Hat Ansible Engine 2.8 for RHEL 8 x86_64 (RPMs) 42 kB/s | 249 kB 00:05
Last metadata expiration check: 0:00:01 ago on Mon 19 Aug 2019 07:10:08 AM IST.
Available Packages
ansible.noarch 2.8.3-1.linuxnixae ansible-2.8-for-rhel-8-x86_64-rpms

Let's install it using yum.

[root@linuxnix ~]# yum install ansible
Updating Subscription Management repositories.
Red Hat Ansible Engine 2 for RHEL 8 x86_64 (Source RPMs) 2.0 kB/s | 3.7 kB 00:01
Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) 4.9 kB/s | 4.5 kB 00:00
Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs) 2.1 kB/s | 4.0 kB 00:01
Dependencies resolved.
Package Arch Version Repository Size
ansible noarch 2.8.3-1.linuxnixae ansible-2.8-for-rhel-8-x86_64-rpms 15 M
Installing dependencies:
sshpass x86_64 1.06-3.linuxnixae ansible-2.8-for-rhel-8-x86_64-rpms 27 k
python3-pytz noarch 2017.2-9.linuxnix rhel-8-for-x86_64-appstream-rpms 54 k
python3-babel noarch 2.5.1-3.linuxnix rhel-8-for-x86_64-appstream-rpms 4.8 M
python3-markupsafe x86_64 0.23-19.linuxnix rhel-8-for-x86_64-appstream-rpms 39 k
python3-jinja2 noarch 2.10.1-2.linuxnix_0 rhel-8-for-x86_64-appstream-rpms 538 k
python3-setuptools noarch 39.2.0-4.linuxnix rhel-8-for-x86_64-baseos-rpms 162 k
Installing weak dependencies:
python3-jmespath noarch 0.9.0-11.linuxnix rhel-8-for-x86_64-appstream-rpms 45 k

Transaction Summary
Install 8 Packages

Total download size: 20 M
Installed size: 101 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): python3-jmespath-0.9.0-11.linuxnix.noarch.rpm 18 kB/s | 45 kB 00:02
(2/8): python3-pytz-2017.2-9.linuxnix.noarch.rpm 54 kB/s | 54 kB 00:01
(3/8): sshpass-1.06-3.linuxnixae.x86_64.rpm 6.1 kB/s | 27 kB 00:04
(4/8): python3-markupsafe-0.23-19.linuxnix.x86_64.rpm 46 kB/s | 39 kB 00:00
(5/8): python3-jinja2-2.10.1-2.linuxnix_0.noarch.rpm 313 kB/s | 538 kB 00:01
(6/8): python3-babel-2.5.1-3.linuxnix.noarch.rpm 1.2 MB/s | 4.8 MB 00:03
(7/8): python3-setuptools-39.2.0-4.linuxnix.noarch.rpm 159 kB/s | 162 kB 00:01
(8/8): ansible-2.8.3-1.linuxnixae.noarch.rpm 1.2 MB/s | 15 MB 00:11
Total 1.7 MB/s | 20 MB 00:11
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : python3-setuptools-39.2.0-4.linuxnix.noarch 1/8
Installing : python3-markupsafe-0.23-19.linuxnix.x86_64 2/8
Installing : python3-pytz-2017.2-9.linuxnix.noarch 3/8
Installing : python3-babel-2.5.1-3.linuxnix.noarch 4/8
Installing : python3-jinja2-2.10.1-2.linuxnix_0.noarch 5/8
Installing : python3-jmespath-0.9.0-11.linuxnix.noarch 6/8
Installing : sshpass-1.06-3.linuxnixae.x86_64 7/8
Installing : ansible-2.8.3-1.linuxnixae.noarch 8/8
Running scriptlet: ansible-2.8.3-1.linuxnixae.noarch 8/8
Verifying : sshpass-1.06-3.linuxnixae.x86_64 1/8
Verifying : ansible-2.8.3-1.linuxnixae.noarch 2/8
Verifying : python3-jmespath-0.9.0-11.linuxnix.noarch 3/8
Verifying : python3-pytz-2017.2-9.linuxnix.noarch 4/8
Verifying : python3-babel-2.5.1-3.linuxnix.noarch 5/8
Verifying : python3-markupsafe-0.23-19.linuxnix.x86_64 6/8
Verifying : python3-jinja2-2.10.1-2.linuxnix_0.noarch 7/8
Verifying : python3-setuptools-39.2.0-4.linuxnix.noarch 8/8
Installed products updated.

ansible-2.8.3-1.linuxnixae.noarch python3-jmespath-0.9.0-11.linuxnix.noarch sshpass-1.06-3.linuxnixae.x86_64 python3-pytz-2017.2-9.linuxnix.noarch
python3-babel-2.5.1-3.linuxnix.noarch python3-markupsafe-0.23-19.linuxnix.x86_64 python3-jinja2-2.10.1-2.linuxnix_0.noarch python3-setuptools-39.2.0-4.linuxnix.noarch

[root@linuxnix ~]#

Ansible has some dependencies on Python so those dependencies get installed as well as shown in the above output. To validate our install let’s check the version of ansible installed on the system.

[root@linuxnix ~]# ansible --version
ansible 2.8.3
config file = /etc/ansible/ansible.cfg
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.6/site-packages/ansible
executable location = /usr/bin/ansible
python version = 3.6.8 (default, Jan 11 2019, 02:17:16) [GCC 8.2.1 20180905 (Red Hat 8.2.1-3)]
[root@linuxnix ~]#



This concludes our post on the step by step install of Ansible on an RHEL 8 system. Stay tuned for more articles on Ansible and RHEL 8.

The following two tabs change content below.

Sahil Suri

He started his career in IT in 2011 as a system administrator. He has since worked with HP-UX, Solaris and Linux operating systems along with exposure to high availability and virtualization solutions. He has a keen interest in shell, Python and Perl scripting and is learning the ropes on AWS cloud, DevOps tools, and methodologies. He enjoys sharing the knowledge he's gained over the years with the rest of the community.