Install and configure Ansible automation on RHEL 8

Ansible is the leading free and opensource configuration management, automation tool. With Ansible, Linux users can control and manage hundreds of servers from a single server known as the Ansible Control Node. Ansible makes it possible for System and Network administrators to provision software and settings on various network devices. Ansible can be used to manage both Unix and Windows host systems. Ansible was initially released 7 years ago. The latest stable version at the point of writing this article is Ansible 2.8.5.Unlike many other automation tools such as Chef and Puppet, Ansible does not require the installation of agents on remote devices. Ansible rides on SSH protocol to communicate with remote host systems. Without the need of installing agents on remote systems, Ansible comes highly recommended since very little CPU and RAM resources are used up by remote systems. In this guide, you will learn how to install and configure Ansible on RHEL 8


To get started, we have a lab setup as shown:

  1. RHEL 8 (Ansible Control Node) IP:
  2. Ubuntu 18.04 Server (Managed host) IP:
  3. A stable internet and network connection

The RHEL 8 system will serve as our Ansible Control node, from where we will connect to and manage the remote Ubuntu 18.04 Server.

Install Ansible on RHEL 8

Let’s jump right in!

Step 1: Update RHEL 8

To install Ansible, first log in to your system and update the system packages using the command:

# sudo dnf update -y

Sample output

After successfully updating the system, you should get the prompt below

Step 2: Install Python3 on RHEL 8

By default, RHEL 8 comes with Python3 installed. If by any chance Python3 is missing from your system, simply run the command:

# sudo dnf install python3

As you can see from the output above, Python3 is already installed. To verify its installation, run the command:

# python3 -V

Sample output

From the output above, the latest version of Python – 3.6.8 – is installed by default.

Step 3: Install Ansible

With the prerequisites in check, now proceed and install Ansible using the commands:

$ subscription-manager repos –enable ansible-2.8-for-rhel-8-x86_64-rpms

Sample output

Next, run the command below to install Ansible:

$ sudo  dnf -y install ansible

Sample output

After successful installation, you should get the following output:

To check Ansible version simply use the command:

# ansible –version

Ansible’s configuration file is ansible.cfg located at /etc/ansible/ansible.cfg. 

Great! we have successfully installed Ansible on RHEL 8.

In the next section, we shall configure our Ansible Control node to communicate with and manage the remote Ubuntu 18.04 server system.

Step 4: Configure Passwordless SSH connection to the remote host

To efficiently manage our remote node, we need to configure Passwordless SSH login to it.

First, let’s check whether SSH is up and running on the Ansible Control. Run the command:

# sudo systemctl status sshd

Sample output

Great! SSH service is up and running as expected. Verify the same on the remote Ubuntu server host.

With SSH running on both systems, let’s configure passwordless SSH login from the control node to the remote host.

From the Ansible control node (RHEL 8) generate SSH keys as shown:

# ssh-keygen

Press ENTER for all the prompts. You should get the output as shown:

Sample output

The command generates an SSH key-pair i.e Private and Public key. The private key resides on the Ansible control node while the public key is copied to the managed node. To copy the public key to the managed node run the command:

# ssh-copy-id james@

To continue, type Yes and provided the user’s login password.

Thereafter, you will get the notification that the key has been added.

Sample output

To verify that the Password less login was a success, try logging in using the syntax

# ssh user@remote-IP address

For this case, the command will be:

# ssh james@

Step 5: Configure Ansible to communicate with Hosts

For Ansible to control and manage remote hosts, we need to define the remote host system in Ansible’s inventory file located at /etc/ansible/hosts.

So, proceed and open the ‘hosts’ inventory file using vim editor

# vim /etc/ansible/hosts

At the very end of the inventory file, specify an arbitrary group name for your host system and add the host’s IP address. For example, webserver is the group name and the IP address defined is the IP address of the remote host.


Save and close the inventory file.

We’re now set to manage our host system. To test connectivity using the ping module , run the Ansible adhoc command as shown.

# ansible -m ping webserver
# ansible -m ping

Sample output

If there were hundreds or even thousands of servers, we would use the ping module with the all attribute to test connectivity to the systems using a single command.

# ansible -m ping all

And this wraps up this topic on Installing and configuring Ansible automation tool. We have installed Ansible and set it up to manage the remote host system. Your feedback is most welcome.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Red Hat Taps Naren Gupta as Chairman of the Board

Red Hat recently announced that tech pioneer and well-known venture capitalist Naren Gupta had been selected to be its next...

How to Become Red Hat Certified and Is It Worth It for Your Career?

Red Hat’s contribution to the open source community is immeasurable. The American multinational software company is probably...

How To Manage Layered Local Storage With Stratis On RHEL 8

Stratis Is a local-management storage solution by the  RedHat team introduced with RHEL 8  that enables System administrators...
Bài Viết

Bài Viết Mới Cập Nhật

Mua Proxy V6 Nuôi Facebook Spam Hiệu Quả Tại Onetcomvn

Hướng dẫn cách sử dụng ProxyDroid để duyệt web ẩn danh

Mua proxy Onet uy tín tại

Thuê mua IPv4 giá rẻ, tốc độ nhanh, uy tín #1

Thuê địa chỉ IPv4 IPv6 trọn gói ở đâu chất lượng, giá RẺ nhất?