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

95 řádky
4.0 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. # This one will not be deleted if `matrix_static_files_file_index_html_enabled` flips to `false`.
  48. # See the comment for `matrix_static_files_file_index_html_enabled` to learn why.
  49. - content: "{{ matrix_static_files_file_index_html_template }}"
  50. dest: "{{ matrix_static_files_public_path }}/index.html"
  51. when: "{{ matrix_static_files_file_index_html_enabled }}"
  52. - name: Ensure /.well-known/matrix/server file deleted if not enabled
  53. ansible.builtin.file:
  54. path: "{{ matrix_static_files_public_well_known_matrix_path }}/server"
  55. state: absent
  56. when: "not matrix_static_files_file_matrix_server_enabled | bool"
  57. - name: Ensure /.well-known/matrix/support file deleted if not enabled
  58. ansible.builtin.file:
  59. path: "{{ matrix_static_files_public_well_known_matrix_path }}/support"
  60. state: absent
  61. when: "not matrix_static_files_file_matrix_support_enabled | bool"
  62. - name: Ensure matrix-static-files container image is pulled
  63. community.docker.docker_image:
  64. name: "{{ matrix_static_files_container_image }}"
  65. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  66. force_source: "{{ matrix_static_files_container_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  67. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_static_files_container_image_force_pull }}"
  68. register: result
  69. retries: "{{ devture_playbook_help_container_retries_count }}"
  70. delay: "{{ devture_playbook_help_container_retries_delay }}"
  71. until: result is not failed
  72. - name: Ensure matrix-static-files container network is created
  73. community.general.docker_network:
  74. enable_ipv6: "{{ devture_systemd_docker_base_ipv6_enabled }}"
  75. name: "{{ matrix_static_files_container_network }}"
  76. driver: bridge
  77. - name: Ensure matrix-static-files systemd service is installed
  78. ansible.builtin.template:
  79. src: "{{ role_path }}/templates/systemd/matrix-static-files.service.j2"
  80. dest: "{{ devture_systemd_docker_base_systemd_path }}/{{ matrix_static_files_identifier }}.service"
  81. mode: 0644