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ů.
 
 

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