Integration with Ansible is increasingly important for Red Hat Enterprise Linux administrators. Administrators...
can automate their work through Ansible and make it easier to manage Red Hat Linux Enterprise in large-scale environments. To manage nodes with Ansible, you'll need a playbook to define the properties to manage and the tasks to execute on target systems. Red Hat System Roles will make this process a lot more efficient.
Red Hat System Roles were introduced with the release of RHEL 7.4. Red Hat System Roles are currently available as a technology preview and provide a collection of Ansible roles that allow administrators to manage RHEL in a consistent way.
Red Hat System Roles are based on the upstream Linux System Roles project, which currently supports RHEL 6+, CentOS 6+ and Fedora. This project aims to provide a consistent API-like interface for Linux management, so there is no need to consider differences between major and minor versions of Linux distributions. If your Linux distribution supports Linux System Roles, you can manage its parameters using an Ansible playbook that addresses these System Roles, without considering differences that may exist between distributions.
It's helpful to use System Roles where there are huge differences in the OS, such as network configuration. With System Roles, these differences don't matter anymore, as it is possible to address managed systems using a generic Ansible playbook.
How to use Red Hat System Roles
In the current version, Red Hat offers five role sets: kdump, postfix, network, selinux and timesync.
In RHEL 7.4, you can access System Roles through the Red Hat Network Extras channel, which offers access to new and often rapidly evolving software packages. Use System Roles on a server that is configured as an Ansible management system and is running Ansible Engine. This server must be running RHEL 7.4. With System Roles, you can manage RHEL 6.9 and later as a client. System Roles require the clients to be completely set up as Ansible managed clients.
Red Hat System Roles allow administrators to efficiently manage specific properties of a host. This is illustrated in the following example code:
$ vim example-network-playbook.yml
- hosts: rhel7.4-test
- name: DBnic
- role: rhel-system-roles.network
In this example, the last line includes the rhel-system-roles.network System Role. This role allows administrators to manage different properties of a network card, using variables that the System Role provides. For a complete list of available variables, administrators can consult the documentation in /usr/share/doc/rhel-system-roles. The example code provides an overview of a few of these variables.
After you create a playbook, you can run it against managed hosts using the ansible-playbook command. For example, use ansible-playbook -l server1 example-network-playbook.yml to apply the settings from this System Role to server1, which will apply the configuration from the Ansible playbook to the eth1 network interface.
System Roles can ease the management of heterogeneous systems and nodes in Ansible environments. Although the project is currently Red Hat-oriented, other Linux distributions will likely integrate in the future. If and when that happens, System Roles have all that you need to manage Linux more easily.
Find alternatives to Btrfs for RHEL 8 and beyond
Dependency hell relief from future RHEL releases
Make the most of Linux management with these tips