Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

106 строки
4.6 KiB

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