Files
matrix-docker-ansible-deploy/roles/custom/matrix-synapse/tasks/ext/s3-storage-provider/setup_install.yml
T
Slavi PantaleevandClaude Opus 5.5 833c990ad4 Make Synapse's base, bin and ext paths owned by root
Root runs register-user and s3-storage-provider's migrate (from a systemd timer) from bin paths under them.
Whoever owns a parent of a bin path could rename it (even a root-owned one) and put another in its place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 09:39:40 +02:00

71 lines
3.0 KiB
YAML

# SPDX-FileCopyrightText: 2022 - 2025 Slavi Pantaleev
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
# We install this into Synapse by making `matrix_synapse_ext_synapse_s3_storage_provider_enabled` influence other variables:
# - `matrix_synapse_media_storage_providers` (via `matrix_synapse_media_storage_providers_auto`)
# - `matrix_synapse_container_image_customizations_enabled`
# - `matrix_synapse_container_image_customizations_s3_storage_provider_installation_enabled`
#
# Below are additional tasks for setting up various helper scripts, etc.
# Owned by root: root runs the scripts in the bin path (`migrate` from a systemd timer) and reads the env file.
- name: Ensure s3-storage-provider paths exists
ansible.builtin.file:
path: "{{ item }}"
state: directory
mode: '0750'
owner: root
group: "{{ matrix_synapse_gid }}"
with_items:
- "{{ matrix_synapse_ext_s3_storage_provider_base_path }}"
- "{{ matrix_synapse_ext_s3_storage_provider_bin_path }}"
- name: Ensure s3-storage-provider env file installed
ansible.builtin.template:
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/env.j2"
dest: "{{ matrix_synapse_ext_s3_storage_provider_base_path }}/env"
mode: '0640'
register: matrix_synapse_s3_storage_provider_env_result
- name: Ensure s3-storage-provider database.yaml file installed
ansible.builtin.template:
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/database.yaml.j2"
dest: "{{ matrix_synapse_ext_s3_storage_provider_data_path }}/database.yaml"
mode: '0640'
register: matrix_synapse_s3_storage_provider_database_config_result
- name: Ensure s3-storage-provider scripts installed
ansible.builtin.template:
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/bin/{{ item }}.j2"
dest: "{{ matrix_synapse_ext_s3_storage_provider_bin_path }}/{{ item }}"
owner: root
group: root
mode: '0750'
with_items:
- shell
- migrate
register: matrix_synapse_s3_storage_provider_scripts_result
- name: Ensure matrix-synapse-s3-storage-provider-migrate.service and timer are installed
ansible.builtin.template:
src: "{{ role_path }}/templates/synapse/ext/s3-storage-provider/systemd/{{ item }}.j2"
dest: "{{ devture_systemd_docker_base_systemd_path }}/{{ item }}"
mode: '0644'
with_items:
- matrix-synapse-s3-storage-provider-migrate.service
- matrix-synapse-s3-storage-provider-migrate.timer
register: matrix_synapse_s3_storage_provider_systemd_service_result
- name: Determine whether s3-storage-provider migrate timer needs a restart
ansible.builtin.set_fact:
matrix_synapse_s3_storage_provider_restart_necessary: >-
{{
matrix_synapse_s3_storage_provider_env_result.changed | default(false)
or matrix_synapse_s3_storage_provider_database_config_result.changed | default(false)
or matrix_synapse_s3_storage_provider_scripts_result.changed | default(false)
or matrix_synapse_s3_storage_provider_systemd_service_result.changed | default(false)
}}