Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
Merge pull request #462 from Spredzy/selinux
Browse files Browse the repository at this point in the history
Ensure files created by ansible installer has proper label
  • Loading branch information
Spredzy authored Oct 19, 2020
2 parents 04f14d1 + 34c5324 commit 39bdb9b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions roles/pulp_common/handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,19 @@
# begin with.
- name: Restore SELinux contexts on Pulp dirs that must exist
command: '/sbin/fixfiles restore {{ __pulp_selinux_label_dirs | join(" ") }}'
# We need the when condition on this particular SELinux handler because it
# gets triggered by "Collect static content".
when:
- ansible_facts.os_family == 'RedHat'
- ansible_facts.selinux.status == "enabled"

# shell for handling '*' in the dir name
- name: Restore SELinux contexts on Pulp dirs that may exist
shell: '/sbin/fixfiles restore {{ __pulp_selinux_label_dirs_optional | join(" ") }}' # noqa 305
register: result
changed_when: result.rc == 0
failed_when: result.rc not in [0,255]
when:
- ansible_facts.os_family == 'RedHat'
- ansible_facts.selinux.status == "enabled"

- name: Collect static content
command: "{{ pulp_django_admin_path }} collectstatic --noinput --link {{ pulp_collectstatic_ignore_list }}"
Expand Down
1 change: 1 addition & 0 deletions roles/pulp_common/tasks/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
owner: root
group: '{{ pulp_group }}'
mode: 0750
notify: Restore SELinux contexts on Pulp dirs that must exist

- name: Create configuration file for Pulp
template:
Expand Down
1 change: 1 addition & 0 deletions roles/pulp_common/tasks/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
# The check implicitly does an or for this check:
# developer_user is not defined
when: pulp_user != developer_user|default('')
notify: Restore SELinux contexts on Pulp dirs that must exist

- name: Add user {{ pulp_user }} to extra groups
user:
Expand Down

0 comments on commit 39bdb9b

Please sign in to comment.