d77fe55516
Until now, we only relied on the ":z" flag in order to set container volumes label to container_file_t. While it works fine, it has multiple issues: - if an operator runs a restorecon, it might break the container service - if an SELinux related package is updated, it might reset the label, and break the container service - it requires a container stop&start to reset the label to the expected value - in case of deep tree or huge amount of file, relabelling takes time This change ensures the system sets the expected context on the specific locations, instead of following the content of selinux-policy-targeted rulesets. It has an equivalent for some locations in tripleo-ansible repository: https://review.opendev.org/c/openstack/tripleo-ansible/+/782393 Note about swift locations: Since openstack-selinux already sets fcontext rules for, at least, once swift location, we can't override it here. The following openstack-selinux patch is being pushed in order to work around this specific case: https://github.com/redhat-openstack/openstack-selinux/pull/73 Change-Id: Icb7f58004e281b42141c70a9a4895905dc32b45d Resolves: rhbz#1941922
26 lines
758 B
YAML
26 lines
758 B
YAML
- name: Create fcontext entry for container-config-scripts
|
|
sefcontext:
|
|
target: "/var/lib/container-config-scripts(/.*)?"
|
|
setype: container_file_t
|
|
state: present
|
|
tags:
|
|
- container_config_scripts
|
|
|
|
- name: Create /var/lib/container-config-scripts
|
|
become: true
|
|
file:
|
|
path: /var/lib/container-config-scripts
|
|
state: directory
|
|
setype: container_file_t
|
|
tags:
|
|
- container_config_scripts
|
|
|
|
- name: Write container config scripts
|
|
become: true
|
|
no_log: True
|
|
tripleo_container_config_scripts:
|
|
config_data: "{{ lookup('file', tripleo_role_name + '/container_config_scripts.yaml', errors='ignore') | default({}, True) | from_yaml }}"
|
|
config_dir: /var/lib/container-config-scripts
|
|
tags:
|
|
- container_config_scripts
|