Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
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: NEW
Alias: None
Product: ovirt-engine-metrics
Classification: oVirt
Component: Generic
Version: 1.2.0.2
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ovirt-4.4.0
: ---
Assignee: Shirly Radco
QA Contact: Lukas Svaty
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-12 09:14 UTC by Jan Zmeskal
Modified: 2019-03-26 08:37 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
oVirt Team: Metrics
sradco: ovirt-4.4?


Attachments (Terms of Use)

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".


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