Install and configure Ansible automation on RHEL 8

Chưa phân loại
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

Optimizing Linux Memory Usage

In part one of this series, we had a closer look at the Swap space, and part two dealt with tools and commands to manage...

Top 10 Torrenting Clients For Linux

If you haven’t been living under a rock for the last 10 years or so, it’s certain that you’ve come across the term...

Why were ES Mapping Types removed in ES v6.0?

What are Mapping Types? In Elasticsearch, each document belongs to an Index and a Type. An Index can be considered as a...
Bài Viết

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

Cách gắn set proxy cho điện thoại android, oppo, giả lập android, Ldplayer Bằng Proxydroid

Mua Proxy Socks5 VN Chơi Game Gia Lập Tăng Cường Trải Nghiệm Chơi Game

Mua Proxy Mỹ, Us Nuôi Tài Khoản Etsy, eBay Tìm Hiểu Về Mua Proxy Mỹ tại

Mua Proxy Game – Giải pháp tuyệt vời cho việc chơi game trên mạng mà không bị giới hạn về vị trí địa lý

Sử dụng Proxy để Quản Lý Tài Khoản Quảng Cáo Ads Một Cách An Toàn