mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-06-30 12:00:31 +03:00
ee1cd217a8
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>
55 lines
2.2 KiB
YAML
55 lines
2.2 KiB
YAML
# SPDX-FileCopyrightText: 2017 - 2025 Slavi Pantaleev
|
|
# SPDX-FileCopyrightText: 2018 - 2022 MDAD project contributors
|
|
# SPDX-FileCopyrightText: 2019 Stuart Mumford
|
|
# SPDX-FileCopyrightText: 2020 Béla Becker
|
|
# SPDX-FileCopyrightText: 2020 Chris van Dijk
|
|
# SPDX-FileCopyrightText: 2020 Horvath Gergely
|
|
# 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 }}"
|
|
state: directory
|
|
mode: "{{ matrix_base_data_path_mode }}"
|
|
owner: "{{ matrix_user_name }}"
|
|
group: "{{ matrix_group_name }}"
|
|
with_items:
|
|
- "{{ matrix_base_data_path }}"
|
|
- "{{ matrix_bin_path }}"
|
|
|
|
- name: Ensure remove-all script created
|
|
ansible.builtin.template:
|
|
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
|
|
)
|