Apr 23, 2021 9 min read

RHCE Ansible Series #10: RHEL System Roles

In this chapter, you'll learn about RHEL specific system roles. Needless to say, this is for Red Hat and CentOS only.

In the previous chapter of the RHCE Ansible series ; you learned to use Ansible Galaxy’s roles and create your own custom roles. Let's continue the discussion on Ansible roles but this time; we will focus on RHEL System Roles.

Red Hat has created a collection of Ansible roles that is primarily targeting RHEL systems; these collections of roles are referred to as Red Hat Enterprise Linux (RHEL) System Roles.

In this tutorial, you will learn how to install and use RHEL System Roles to manage and automate standard RHEL operations.

Installing RHEL System Roles

The RHEL System Roles is provided by the rhel-system-roles package. So, let’s go ahead and install the rhel-system-roles package:

[[email protected]ol plays]$ sudo yum search rhel-system-roles
=================== Name Exactly Matched: rhel-system-roles ====================
rhel-system-roles.noarch : Set of interfaces for unified system management

[[email protected] plays]$ sudo yum -y install rhel-system-roles

Installed:
  rhel-system-roles-1.0-10.el8_1.noarch                                         

Complete!

The RHEL system roles will be installed in the /usr/share/ansible/roles directory:

[[email protected] plays]$ ls -l /usr/share/ansible/roles
total 0
lrwxrwxrwx.  1 root root  23 Oct 22  2019 linux-system-roles.kdump -> rhel-system-roles.kdump
lrwxrwxrwx.  1 root root  25 Oct 22  2019 linux-system-roles.network -> rhel-system-roles.network
lrwxrwxrwx.  1 root root  25 Oct 22  2019 linux-system-roles.postfix -> rhel-system-roles.postfix
lrwxrwxrwx.  1 root root  25 Oct 22  2019 linux-system-roles.selinux -> rhel-system-roles.selinux
lrwxrwxrwx.  1 root root  25 Oct 22  2019 linux-system-roles.storage -> rhel-system-roles.storage
lrwxrwxrwx.  1 root root  26 Oct 22  2019 linux-system-roles.timesync -> rhel-system-roles.timesync
drwxr-xr-x.  9 root root 156 Nov 14 22:44 rhel-system-roles.kdump
drwxr-xr-x.  8 root root 177 Nov 14 22:44 rhel-system-roles.network
drwxr-xr-x.  6 root root 114 Nov 14 22:44 rhel-system-roles.postfix
drwxr-xr-x.  8 root root 138 Nov 14 22:44 rhel-system-roles.selinux
drwxr-xr-x. 10 root root 215 Nov 14 22:44 rhel-system-roles.storage
drwxr-xr-x. 11 root root 187 Nov 14 22:44 rhel-system-roles.timesync

As you can see from listing the contents of /usr/share/ansible/roles; the following RHEL system roles are currently provided:

  1. rhel-system-roles.kdump -> configures the kdump crash recovery service.
  2. rhel-system-roles.network -> configures the network interfaces.
  3. rhel-system-roles.postfix -> configures a host as a Postfix MTA.
  4. rhel-system-roles.selinux  ->manages all aspects of SELinux.
  5. rhel-system-roles.storage -> configures local storage.
  6. rhel-system-roles.timesync -> configures Network Time Protocol (NTP) or Precision Time Protocol (PTP).

It’s highly likely that additional RHEL system roles will be introduced in the future.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to Linux Handbook.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.