Add Synology DSM support (#5315)

Adds optional support for running the playbook on Synology DSM 7+, detected
automatically via /etc/synoinfo.conf so that non-Synology hosts are unaffected.

Includes DSM-native user/group management (synouser/synogroup), a requests
version constraint for Docker SDK compatibility, and a boot-fix service that
re-shares the volume mount and starts matrix services skipped by DSM's boot
ordering. The shared-mount volume path is configurable via
matrix_base_synology_volume_path, and the make-shared step only runs when the
volume is not already shared.

Co-authored-by: CKSit <sitchiuki@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
cksit
2026-06-30 00:45:01 +08:00
committed by GitHub
parent 4f9346e182
commit ee1cd217a8
13 changed files with 490 additions and 23 deletions
@@ -7,11 +7,20 @@
# SPDX-FileCopyrightText: 2022 Sebastian Gumprich
# SPDX-FileCopyrightText: 2024 - 2025 Suguru Hirahara
# SPDX-FileCopyrightText: 2024 László Várady
# SPDX-FileCopyrightText: 2026 Chiu Ki Sit
#
# SPDX-License-Identifier: AGPL-3.0-or-later
---
# Snapshot ownership before any changes so we can decide whether a recursive
# chown is needed (only when uid/gid actually differs from expected).
- name: Check current ownership of Matrix base path (Synology)
ansible.builtin.stat:
path: "{{ matrix_base_data_path }}"
register: matrix_base_data_path_stat
when: matrix_base_host_is_synology
- name: Ensure Matrix base paths exists
ansible.builtin.file:
path: "{{ item }}"
@@ -28,3 +37,18 @@
src: "{{ role_path }}/templates/bin/remove-all.j2"
dest: "{{ matrix_bin_path }}/remove-all"
mode: '0750'
# On Synology, name-based chown works for directly-touched paths but leaves
# existing sub-paths with stale numeric ownership when uid/gid changes between
# runs. We recurse only when the pre-task uid/gid didn't match, so normal runs
# skip the expensive tree walk entirely. chown -R is used instead of the file
# module's recurse option to avoid Ansible iterating every entry in Python.
- name: Ensure Matrix base path ownership is correct using numeric UID/GID (Synology)
ansible.builtin.command: chown -R {{ matrix_user_uid }}:{{ matrix_user_gid }} {{ matrix_base_data_path }}
changed_when: true
when: >-
matrix_base_host_is_synology and (
not matrix_base_data_path_stat.stat.exists or
matrix_base_data_path_stat.stat.uid | int != matrix_user_uid | int or
matrix_base_data_path_stat.stat.gid | int != matrix_user_gid | int
)