Matrix Docker Ansible eploy
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

101 řádky
4.2 KiB

  1. # SPDX-FileCopyrightText: 2024 David Mehren
  2. # SPDX-FileCopyrightText: 2024 Slavi Pantaleev
  3. #
  4. # SPDX-License-Identifier: AGPL-3.0-or-later
  5. ---
  6. - name: Ensure matrix-static-files paths exist
  7. ansible.builtin.file:
  8. path: "{{ item }}"
  9. state: directory
  10. mode: 0750
  11. owner: "{{ matrix_user_username }}"
  12. group: "{{ matrix_user_groupname }}"
  13. with_items:
  14. - "{{ matrix_static_files_base_path }}"
  15. - "{{ matrix_static_files_config_path }}"
  16. - "{{ matrix_static_files_public_path }}"
  17. - "{{ matrix_static_files_public_well_known_path }}"
  18. - "{{ matrix_static_files_public_well_known_matrix_path }}"
  19. - name: Ensure matrix-static-files is configured
  20. ansible.builtin.template:
  21. src: "{{ item.src }}"
  22. dest: "{{ item.dest }}"
  23. owner: "{{ matrix_user_username }}"
  24. group: "{{ matrix_user_groupname }}"
  25. mode: 0644
  26. with_items:
  27. - src: "{{ role_path }}/templates/config.toml.j2"
  28. dest: "{{ matrix_static_files_config_path }}/config.toml"
  29. - src: "{{ role_path }}/templates/env.j2"
  30. dest: "{{ matrix_static_files_base_path }}/env"
  31. - src: "{{ role_path }}/templates/labels.j2"
  32. dest: "{{ matrix_static_files_base_path }}/labels"
  33. - name: Ensure matrix-static-files files are installed
  34. ansible.builtin.copy:
  35. content: "{{ item.content }}"
  36. dest: "{{ item.dest }}"
  37. mode: 0644
  38. owner: "{{ matrix_user_username }}"
  39. group: "{{ matrix_user_groupname }}"
  40. when: item.when | bool
  41. with_items:
  42. - content: "{{ matrix_static_files_file_matrix_client_configuration | to_nice_json }}"
  43. dest: "{{ matrix_static_files_public_well_known_matrix_path }}/client"
  44. when: true
  45. - content: "{{ matrix_static_files_file_matrix_server_configuration | to_nice_json }}"
  46. dest: "{{ matrix_static_files_public_well_known_matrix_path }}/server"
  47. when: "{{ matrix_static_files_file_matrix_server_enabled }}"
  48. - content: "{{ matrix_static_files_file_matrix_support_configuration | to_nice_json }}"
  49. dest: "{{ matrix_static_files_public_well_known_matrix_path }}/support"
  50. when: "{{ matrix_static_files_file_matrix_support_enabled }}"
  51. # This one will not be deleted if `matrix_static_files_file_index_html_enabled` flips to `false`.
  52. # See the comment for `matrix_static_files_file_index_html_enabled` to learn why.
  53. - content: "{{ matrix_static_files_file_index_html_template }}"
  54. dest: "{{ matrix_static_files_public_path }}/index.html"
  55. when: "{{ matrix_static_files_file_index_html_enabled }}"
  56. - name: Ensure /.well-known/matrix/server file deleted if not enabled
  57. ansible.builtin.file:
  58. path: "{{ matrix_static_files_public_well_known_matrix_path }}/server"
  59. state: absent
  60. when: "not matrix_static_files_file_matrix_server_enabled | bool"
  61. - name: Ensure /.well-known/matrix/support file deleted if not enabled
  62. ansible.builtin.file:
  63. path: "{{ matrix_static_files_public_well_known_matrix_path }}/support"
  64. state: absent
  65. when: "not matrix_static_files_file_matrix_support_enabled | bool"
  66. - name: Ensure matrix-static-files container image is pulled
  67. community.docker.docker_image:
  68. name: "{{ matrix_static_files_container_image }}"
  69. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  70. force_source: "{{ matrix_static_files_container_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  71. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_static_files_container_image_force_pull }}"
  72. register: result
  73. retries: "{{ devture_playbook_help_container_retries_count }}"
  74. delay: "{{ devture_playbook_help_container_retries_delay }}"
  75. until: result is not failed
  76. - name: Ensure matrix-static-files container network is created
  77. community.general.docker_network:
  78. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  79. name: "{{ matrix_static_files_container_network }}"
  80. driver: bridge
  81. driver_options: "{{ devture_systemd_docker_base_container_networks_driver_options }}"
  82. - name: Ensure matrix-static-files systemd service is installed
  83. ansible.builtin.template:
  84. src: "{{ role_path }}/templates/systemd/matrix-static-files.service.j2"
  85. dest: "{{ devture_systemd_docker_base_systemd_path }}/{{ matrix_static_files_identifier }}.service"
  86. mode: 0644