RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1757857 - rhel-system-roles should not reload the SELinux policy if its not changed
Summary: rhel-system-roles should not reload the SELinux policy if its not changed
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rhel-system-roles
Version: 7.7
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Petr Lautrbach
QA Contact: Jakub Haruda
Whiteboard: role:selinux
Depends On:
Blocks: 1757869
TreeView+ depends on / blocked
Reported: 2019-10-02 15:06 UTC by Ron van der Wees
Modified: 2022-02-22 19:01 UTC (History)
9 users (show)

Fixed In Version: rhel-system-roles-1.7.3-2.el7_9
Doc Type: Bug Fix
Doc Text:
Cause: The selinux role was not checking to see if any changes were actually applied before reloading selinux policy. Consequence: The selinux policy was being reloaded unnecessarily. Policy reload is expensive. Fix: Use ansible handlers and conditionals so that the policy is only reloaded if it is changed. Result: selinux role runs much faster if no policy needs to be reloaded.
Clone Of:
: 1757869 (view as bug list)
Last Closed: 2022-02-22 18:56:17 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Github linux-system-roles selinux pull 56 0 None closed Add ability to manage SELinux modules 2021-04-01 23:54:09 UTC
Red Hat Product Errata RHBA-2022:0644 0 None None None 2022-02-22 18:56:27 UTC

Description Ron van der Wees 2019-10-02 15:06:41 UTC
Description of problem:
The rhel-system-roles.selinux has a task to always force a policy reload,
which seems as kind of a sledge hammer approach as a reload might not be
The task that handles the reload is always flagged as changed in the play
recap which makes it hard to determine if there was actual configuration drift
on the systems the role was applied on (it is non-idempotent).

How reproducible:

Steps to Reproduce:
1. Use the selinux system-role that changes the policy
2. Re apply the role

Actual results:
After reapplying the role, nothing has changed but the playbook shows a
changed task
Expected results:
After an initial playbook run using the rhel-system-roles.selinux role
subsequent runs should not display any changed tasks.

Additional info:
From selinux/main.yml
- name: Reload SELinux policy
  command: semodule -R
  when: ansible_selinux.status != "disabled"

Comment 1 Ron van der Wees 2019-10-02 15:07:28 UTC
This may also apply to RHEL8

Comment 2 Pavel Cahyna 2019-10-02 15:25:44 UTC
Indeed, this is a problem, we fixed some of those issues in https://github.com/linux-system-roles/selinux/pull/38, but some remain. Concerning RHEL 8, I will create a clone.

Comment 7 Noriko Hosoi 2021-07-22 23:07:48 UTC
Hi @djez, could you give your qa_ack+?

Comment 22 errata-xmlrpc 2022-02-22 18:56:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (rhel-system-roles bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.