mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-08-01 11:16:05 +10:00
e5b8de8c2b
6b4b7647e fixed this for synapse-usage-exporter only. A checkout owned by
a different user makes the git task fail from then on, either with a
permission error or with git's dubious-ownership protection, until
someone removes the directory on the host by hand. It gets into that
state when the matrix user's uid changes (a server migration or a restore
onto a differently numbered user), when an earlier clone ran as another
user, or when someone runs git as root inside the checkout.
Every other role cloning a repository onto the server was open to the
same failure, so ensure the checkout's ownership recursively before
updating it at the remaining 54 sites.
The three matrix-synapse ext clones also gain force=yes. They were the
only on-server clones without it, which left a checkout that an
interrupted run had half-written wedged, instead of repaired on the next
run.
matrix-matrixto used to clone as root into a directory that nothing ever
chowned, unlike every other role. It now becomes the matrix user too.
The Element Web and SchildiChat Web theme checkouts live on the Ansible
controller, where correcting ownership is not ours to do, so they merely
mark the checkout as a safe directory for git.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
60 lines
2.2 KiB
YAML
60 lines
2.2 KiB
YAML
# SPDX-FileCopyrightText: 2020 - 2023 Slavi Pantaleev
|
|
# SPDX-FileCopyrightText: 2022 Marko Weltzer
|
|
# SPDX-FileCopyrightText: 2024 Suguru Hirahara
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
---
|
|
|
|
#
|
|
# Tasks related to setting up Element Web themes
|
|
#
|
|
|
|
- when: matrix_client_element_themes_enabled | bool
|
|
run_once: true
|
|
delegate_to: 127.0.0.1
|
|
become: false
|
|
block:
|
|
# This checkout lives on the Ansible controller, so we cannot correct its ownership like we do for checkouts on the server.
|
|
# Marking it as a safe directory keeps git's dubious-ownership protection from failing the task when the playbook directory belongs to another user.
|
|
- name: Ensure Element Web themes repository is pulled
|
|
ansible.builtin.git:
|
|
repo: "{{ matrix_client_element_themes_repository_url }}"
|
|
version: "{{ matrix_client_element_themes_repository_version }}"
|
|
dest: "{{ role_path }}/files/scratchpad/themes"
|
|
environment:
|
|
GIT_CONFIG_COUNT: "1"
|
|
GIT_CONFIG_KEY_0: safe.directory
|
|
GIT_CONFIG_VALUE_0: "{{ role_path }}/files/scratchpad/themes"
|
|
|
|
- name: Find all Element Web theme files
|
|
ansible.builtin.find:
|
|
paths: "{{ role_path }}/files/scratchpad/themes"
|
|
patterns: "*.json"
|
|
recurse: true
|
|
register: matrix_client_element_theme_file_list
|
|
|
|
- name: Read Element Web theme
|
|
ansible.builtin.slurp:
|
|
path: "{{ item.path }}"
|
|
register: "matrix_client_element_theme_file_contents"
|
|
with_items: "{{ matrix_client_element_theme_file_list.files }}"
|
|
|
|
- name: Load Element Web theme
|
|
ansible.builtin.set_fact:
|
|
matrix_client_element_setting_defaults_custom_themes: "{{ matrix_client_element_setting_defaults_custom_themes + [item['content'] | b64decode | from_json] }}" # noqa var-naming
|
|
with_items: "{{ matrix_client_element_theme_file_contents.results }}"
|
|
|
|
#
|
|
# Tasks related to getting rid of Element Web themes (if it was previously enabled)
|
|
#
|
|
|
|
- name: Ensure Element Web themes repository is removed
|
|
ansible.builtin.file:
|
|
path: "{{ role_path }}/files/scratchpad/themes"
|
|
state: absent
|
|
run_once: true
|
|
delegate_to: 127.0.0.1
|
|
become: false
|
|
when: "not matrix_client_element_themes_enabled | bool"
|