Chapter #17: How to Install and Configure an Ansible Control Node
In this article, we walk you through setting up an Ansible control node on RHEL 9, including SSH key setup, inventory configuration, and testing connections to remote Linux hosts.

In this chapter, we will demonstrate how to install and configure an Ansible control node on RHEL.
In our setup, weβre using 1 Ansible server and 2 remote Linux nodes:
- Control Node 1: RHEL Server - IP:
192.168.0.108
β Ansible Server - Managed Host 1: Debian - IP:
192.168.0.15
β Web Server - Managed Host 2: Rocky Linux - IP:
192.168.0.200
β Database Server
An Ansible control node is a Linux system where Ansible is installed and used to manage remote hosts or nodes. These remote systems are known as Managed Hosts (or Managed Nodes).
In the setup above, the control node is the RHEL server (where Ansible will be installed), and Debian & Rocky Linux are the managed hosts.
β οΈ Note: Ansible is only installed on the control node, not on the managed hosts.
Installing Python 3
By default, RHEL comes with Python 3 and you can verify the version of Python installed on your server by running.
python3 -V
If for whatever reason Python3 is not installed, install it using the following dnf command.
dnf install python3
If multiple versions of Python exist on your RHEL system, you can set Python 3 as the default Python version by running.
alternatives --set python /usr/bin/python3
Installing Ansible on RHEL
On RHEL, there's no need to enable any external or optional repository to install Ansible. The ansible-core
package is included in the AppStream repository, which is enabled by default.
To install Ansible, just run:
dnf install ansible-core -y
Once installed, verify it using:
ansible --version

Creating a Static Host Inventory File
So far, we have successfully installed ansible on the Control Node which is our RHEL 9 server. The remote nodes to be managed by the control node need to be defined in a file called the inventory file.
The inventory file is a plain text file that resides on the control node and consists of the remote hostsβ hostnames or IP addresses.
A static host file is a plain text file that contains a list of managed nodes defined by their IP addresses or hostnames. Letβs create a static file hosts
in the /etc/ansible/
directory.
vi /etc/ansible/hosts
Next, define a group or groups for your managed hosts. We have 2 managed hosts as earlier seen in the setup at the introduction of this topic. From the setup, the static host file will be defined as follows:
[webserver]
192.168.0.15
[database_server]
192.168.0.200
Save and exit the inventory file.
To list managed hosts run:
ansible all -i hosts --list-hosts

Thus far, we have managed to install Ansible in the control node and define the managed hosts in a static Host file residing on the control node.
Next, we are going to see how we can manage or control our remote or managed hosts.