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.
 
 

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