diff --git a/roles/pulp_common/handlers/main.yml b/roles/pulp_common/handlers/main.yml index bfe4751a6..4cf056cd7 100644 --- a/roles/pulp_common/handlers/main.yml +++ b/roles/pulp_common/handlers/main.yml @@ -11,8 +11,9 @@ # 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 @@ -20,6 +21,9 @@ 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 }}" diff --git a/roles/pulp_common/tasks/configure.yml b/roles/pulp_common/tasks/configure.yml index 7e73031ac..ac3d3356b 100644 --- a/roles/pulp_common/tasks/configure.yml +++ b/roles/pulp_common/tasks/configure.yml @@ -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: diff --git a/roles/pulp_common/tasks/install.yml b/roles/pulp_common/tasks/install.yml index ab663308b..5bbd4c4db 100644 --- a/roles/pulp_common/tasks/install.yml +++ b/roles/pulp_common/tasks/install.yml @@ -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: