Bug 1687729 - Code Change - Use dedicated Ansible module for manageing SELinux file context
Summary: Code Change - Use dedicated Ansible module for manageing SELinux file context
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine-metrics
Classification: oVirt
Component: Generic
Version: 1.2.0.2
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ovirt-4.4.0
: ---
Assignee: Shirly Radco
QA Contact: Lucie Leistnerova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-12 09:14 UTC by Jan Zmeskal
Modified: 2020-05-20 20:00 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2020-05-20 20:00:22 UTC
oVirt Team: Metrics
Embargoed:
sradco: ovirt-4.4?


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 104270 0 master MERGED Replaced shell command with ansible sefcontext module 2019-11-10 13:29:08 UTC

Description Jan Zmeskal 2019-03-12 09:14:48 UTC
Description of problem:
In install_okd.yaml playbook we use shell Ansible module to manipulate SELinux file context, see here: https://gerrit.ovirt.org/#/c/97643/48/roles/oVirt.metrics-store-installation/templates/install_okd.yaml.template@56

According to Ansible documentation and best practices, using shell and command modules should be avoided unless absolutely necessary, since it:
- makes the code less maintainable
- makes the code less readable
- loses Ansible's idempotency

sefcontext Ansible module looks like a perfect fit for this: https://docs.ansible.com/ansible/latest/modules/sefcontext_module.html
According to its documentation, it's "similar to the semanage fcontext command". So it looks like it should be capable of the very same thing we do with shell module now.

Verification steps: Check that install_okd.yaml does not use shell module for task with name "Fixup SELinux permissions for elasticsearch".

Comment 2 Sandro Bonazzola 2020-05-20 20:00:22 UTC
This bugzilla is included in oVirt 4.4.0 release, published on May 20th 2020.

Since the problem described in this bug report should be
resolved in oVirt 4.4.0 release, it has been closed with a resolution of CURRENT RELEASE.

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


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