diff --git a/roles/matrix_synapse/tasks/caddy.yml b/roles/matrix_synapse/tasks/caddy.yml index fdd606a..97e98ec 100644 --- a/roles/matrix_synapse/tasks/caddy.yml +++ b/roles/matrix_synapse/tasks/caddy.yml @@ -16,6 +16,18 @@ tags: - caddy +- name: Set SELinux context for log directory + community.general.sefcontext: + target: '/var/log/caddy(/.*)?' + setype: httpd_sys_rw_content_t + state: present + register: set_selinux_context + +# need to apply new contexts "now" to prevent potential issues in later tasks +- name: Apply new SELinux file context to filesystem # noqa no-handler no-changed-when + ansible.builtin.command: restorecon -irv /var/log/caddy + when: set_selinux_context.changed + - name: Distribute /etc/caddy/Caddyfile ansible.builtin.template: src: Caddyfile.j2 diff --git a/roles/mirror/tasks/main.yml b/roles/mirror/tasks/main.yml index 6e73444..108c7c7 100644 --- a/roles/mirror/tasks/main.yml +++ b/roles/mirror/tasks/main.yml @@ -16,6 +16,22 @@ tags: - caddy +- name: Set SELinux context for log directory + community.general.sefcontext: + target: '/var/log/caddy(/.*)?' + setype: httpd_sys_rw_content_t + state: present + register: set_selinux_context + tags: + - caddy + +# need to apply new contexts "now" to prevent potential issues in later tasks +- name: Apply new SELinux file context to filesystem # noqa no-handler no-changed-when + ansible.builtin.command: restorecon -irv /var/log/caddy + when: set_selinux_context.changed + tags: + - caddy + - name: Distribute /etc/caddy/Caddyfile ansible.builtin.template: src: etc/caddy/Caddyfile.j2