Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

64 lines
2.6 KiB

  1. # SPDX-FileCopyrightText: 2019 - 2023 Slavi Pantaleev
  2. # SPDX-FileCopyrightText: 2019 Michael Haak
  3. # SPDX-FileCopyrightText: 2020 Christian Wolf
  4. # SPDX-FileCopyrightText: 2022 Aaron Raimist
  5. # SPDX-FileCopyrightText: 2022 Marko Weltzer
  6. # SPDX-FileCopyrightText: 2022 Sebastian Gumprich
  7. #
  8. # SPDX-License-Identifier: AGPL-3.0-or-later
  9. ---
  10. - name: Fail if Synapse Simple Antispam blocked homeservers is not set
  11. ansible.builtin.fail:
  12. msg: "Synapse Simple Antispam is enabled, but no blocked homeservers have been set in matrix_synapse_ext_spam_checker_synapse_simple_antispam_config_blocked_homeservers"
  13. when: "matrix_synapse_ext_spam_checker_synapse_simple_antispam_config_blocked_homeservers | length == 0"
  14. - name: Ensure git installed
  15. ansible.builtin.package:
  16. name: git
  17. state: present
  18. # A checkout owned by a different user (a uid change, an earlier clone by another user, etc.) would make the git task below fail on ownership or permissions.
  19. - name: Ensure synapse-simple-antispam repository ownership is correct
  20. ansible.builtin.file:
  21. path: "{{ matrix_synapse_ext_path }}/synapse-simple-antispam"
  22. state: directory
  23. owner: "{{ matrix_synapse_uid }}"
  24. group: "{{ matrix_synapse_gid }}"
  25. recurse: true
  26. - name: Clone synapse-simple-antispam git repository
  27. ansible.builtin.git:
  28. repo: "{{ matrix_synapse_ext_spam_checker_synapse_simple_antispam_git_repository_url }}"
  29. version: "{{ matrix_synapse_ext_spam_checker_synapse_simple_antispam_git_version }}"
  30. dest: "{{ matrix_synapse_ext_path }}/synapse-simple-antispam"
  31. force: "yes"
  32. become: true
  33. become_user: "{{ matrix_synapse_username }}"
  34. # Keep this even though the task above normalizes ownership. Git may still see an ownership mismatch when Ansible becomes an unprivileged user (see #5065).
  35. environment:
  36. GIT_CONFIG_COUNT: "1"
  37. GIT_CONFIG_KEY_0: safe.directory
  38. GIT_CONFIG_VALUE_0: "{{ matrix_synapse_ext_path }}/synapse-simple-antispam"
  39. - ansible.builtin.set_fact:
  40. matrix_synapse_modules: >
  41. {{
  42. matrix_synapse_modules
  43. +
  44. [{
  45. "module": "synapse_simple_antispam.AntiSpamInvites",
  46. "config": {
  47. "blocked_homeservers": matrix_synapse_ext_spam_checker_synapse_simple_antispam_config_blocked_homeservers
  48. }
  49. }]
  50. }}
  51. matrix_synapse_container_extra_arguments: >
  52. {{
  53. matrix_synapse_container_extra_arguments | default([])
  54. +
  55. ["--mount type=bind,src=" + matrix_synapse_ext_path + "/synapse-simple-antispam/synapse_simple_antispam,dst=" + matrix_synapse_in_container_python_packages_path + "/synapse_simple_antispam,ro"]
  56. }}