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.

Ahmed Alkabary
Ahmed Alkabary

Table of Contents

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:

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

[elliot@control plays]$ sudo yum -y install rhel-system-roles



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

[elliot@control 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 ->
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 ->
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
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
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. -> 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. -> 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.