EX294 8.4: System roles
Use the RHEL system roles for time synchronization and SELinux, and find a role's variables in its documentation.
Before you start
Time and SELinux belong to the kernel, which the lab's container nodes
share with the VM, so this lab has no managed nodes: the control node
manages itself. The lab creates the user greg (password Lab-Pass-1,
allowed to use sudo) and installs ansible-core and rhel-system-roles,
which AlmaLinux ships in AppStream as the collection
redhat.rhel_system_roles. Work as greg, in /home/greg/ansible: its
ansible.cfg reads the inventory inventory, where the control node is
localhost (with ansible_connection=local) in the group webservers,
and becomes root.
The lab sets SELinux to permissive, now and in /etc/selinux/config, and
turns httpd_can_network_connect off. Reset puts both back, and
/etc/chrony.conf too. The VM needs internet access to reach an NTP
pool.
Tasks
- Write
/home/greg/ansible/timesync.yml, which configures time synchronization on every host with the timesync system role, using a pool your hosts can reach, such aspool.ntp.org.chronyc sourceslists servers from the pool, and a second run changes nothing. - Write
/home/greg/ansible/selinux.yml, which uses the selinux system role to set SELinux to enforcing on all hosts, and turn onhttpd_can_network_connectpersistently on the web servers.getenforceandgetsebool httpd_can_network_connectshow it, also after a reboot. - Find which variable the storage role uses for a logical volume's size,
and write its name to
/root/lab-answers/3.
Hints
/usr/share/doc/rhel-system-roles/ROLE/has each role'sREADME.mdand example playbooks.- The roles are
redhat.rhel_system_roles.timesyncandredhat.rhel_system_roles.selinux. timesync_ntp_serverswithpool: true;selinux_stateandselinux_booleanswithpersistent: true.- In the storage README, look under
storage_poolsfor itsvolumes.