Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

84 wiersze
3.1 KiB

  1. # SPDX-FileCopyrightText: 2025 - 2026 MDAD project contributors
  2. # SPDX-FileCopyrightText: 2025 - 2026 Slavi Pantaleev
  3. #
  4. # SPDX-License-Identifier: AGPL-3.0-or-later
  5. ---
  6. # Migrates from the conduwuit server implementation (`/matrix/conduwuit`) to tuwunel (`/matrix/tuwunel`).
  7. # Tuwunel is the official successor to conduwuit and reads conduwuit's RocksDB layout directly.
  8. # We back up the freshly generated tuwunel directory, copy conduwuit's data into it,
  9. # rename the config file, restore tuwunel's labels file, and start the new service.
  10. - name: Check existence of conduwuit directory
  11. ansible.builtin.stat:
  12. path: "{{ matrix_base_data_path }}/conduwuit"
  13. register: matrix_removed_conduwuit_directory_stat
  14. - name: Check existence of tuwunel directory
  15. ansible.builtin.stat:
  16. path: "{{ matrix_base_data_path }}/tuwunel"
  17. register: matrix_tuwunel_directory_stat
  18. - when: >
  19. matrix_removed_conduwuit_directory_stat.stat.exists | bool and
  20. matrix_tuwunel_directory_stat.stat.exists | bool
  21. block:
  22. - name: Ensure matrix-tuwunel.service systemd service is stopped
  23. ansible.builtin.systemd:
  24. name: matrix-tuwunel
  25. state: stopped
  26. enabled: false
  27. daemon_reload: true
  28. - name: Ensure tuwunel directory is backed up
  29. ansible.builtin.command:
  30. cmd: "mv {{ matrix_base_data_path }}/tuwunel {{ matrix_base_data_path }}/tuwunel_old"
  31. creates: "{{ matrix_base_data_path }}/tuwunel_old"
  32. removes: "{{ matrix_base_data_path }}/tuwunel"
  33. - name: Ensure conduwuit directory contents are copied to tuwunel
  34. ansible.builtin.copy:
  35. src: "{{ matrix_base_data_path }}/conduwuit/"
  36. dest: "{{ matrix_base_data_path }}/tuwunel"
  37. remote_src: true
  38. mode: preserve
  39. - name: Ensure conduwuit.toml file is renamed
  40. ansible.builtin.command:
  41. cmd: "mv {{ matrix_base_data_path }}/tuwunel/config/conduwuit.toml {{ matrix_base_data_path }}/tuwunel/config/tuwunel.toml"
  42. removes: "{{ matrix_base_data_path }}/tuwunel/config/conduwuit.toml"
  43. - name: Ensure tuwunel labels are restored
  44. ansible.builtin.copy:
  45. src: "{{ matrix_base_data_path }}/tuwunel_old/labels"
  46. dest: "{{ matrix_base_data_path }}/tuwunel/labels"
  47. remote_src: true
  48. force: true
  49. mode: preserve
  50. - name: Ensure directories ownership is set
  51. block:
  52. - name: Set tuwunel ownership
  53. ansible.builtin.file:
  54. path: "{{ matrix_base_data_path }}/tuwunel"
  55. state: directory
  56. owner: "{{ matrix_user_name }}"
  57. group: "{{ matrix_group_name }}"
  58. recurse: true
  59. - name: Set tuwunel_old ownership
  60. ansible.builtin.file:
  61. path: "{{ matrix_base_data_path }}/tuwunel_old"
  62. state: directory
  63. owner: "{{ matrix_user_name }}"
  64. group: "{{ matrix_group_name }}"
  65. recurse: true
  66. - name: Ensure matrix-tuwunel.service systemd service is started
  67. ansible.builtin.systemd:
  68. name: matrix-tuwunel
  69. state: started
  70. enabled: true
  71. daemon_reload: true