Matrix Docker Ansible eploy
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

108 líneas
4.8 KiB

  1. ---
  2. - name: Ensure matrix-static-files paths exist
  3. ansible.builtin.file:
  4. path: "{{ item.path }}"
  5. state: directory
  6. mode: 0750
  7. owner: "{{ matrix_user_username }}"
  8. group: "{{ matrix_user_groupname }}"
  9. with_items:
  10. - {path: "{{ matrix_static_files_base_path }}", when: true}
  11. - {path: "{{ matrix_static_files_config_path }}", when: true}
  12. - {path: "{{ matrix_static_files_public_path }}", when: true}
  13. - {path: "{{ matrix_static_files_public_well_known_path }}", when: true}
  14. - {path: "{{ matrix_static_files_public_well_known_matrix_path }}", when: true}
  15. - {path: "{{ matrix_static_files_public_well_known_element_path }}", when: true}
  16. when: "item.when | bool"
  17. - name: Ensure matrix-static-files is configured
  18. ansible.builtin.template:
  19. src: "{{ item.src }}"
  20. dest: "{{ item.dest }}"
  21. owner: "{{ matrix_user_username }}"
  22. group: "{{ matrix_user_groupname }}"
  23. mode: 0644
  24. with_items:
  25. - src: "{{ role_path }}/templates/config.toml.j2"
  26. dest: "{{ matrix_static_files_config_path }}/config.toml"
  27. - src: "{{ role_path }}/templates/env.j2"
  28. dest: "{{ matrix_static_files_base_path }}/env"
  29. - src: "{{ role_path }}/templates/labels.j2"
  30. dest: "{{ matrix_static_files_base_path }}/labels"
  31. - name: Ensure matrix-static-files files are installed
  32. ansible.builtin.copy:
  33. content: "{{ item.content }}"
  34. dest: "{{ item.dest }}"
  35. mode: 0644
  36. owner: "{{ matrix_user_username }}"
  37. group: "{{ matrix_user_groupname }}"
  38. when: item.when | bool
  39. with_items:
  40. - content: "{{ matrix_static_files_file_matrix_client_configuration | to_nice_json }}"
  41. dest: "{{ matrix_static_files_public_well_known_matrix_path }}/client"
  42. when: true
  43. - content: "{{ matrix_static_files_file_matrix_server_configuration | to_nice_json }}"
  44. dest: "{{ matrix_static_files_public_well_known_matrix_path }}/server"
  45. when: "{{ matrix_static_files_file_matrix_server_enabled }}"
  46. - content: "{{ matrix_static_files_file_matrix_support_configuration | to_nice_json }}"
  47. dest: "{{ matrix_static_files_public_well_known_matrix_path }}/support"
  48. when: "{{ matrix_static_files_file_matrix_support_enabled }}"
  49. - content: "{{ matrix_static_files_file_element_element_json_configuration | to_nice_json }}"
  50. dest: "{{ matrix_static_files_public_well_known_element_path }}/element.json"
  51. when: "{{ matrix_static_files_file_element_element_json_enabled }}"
  52. # This one will not be deleted if `matrix_static_files_file_index_html_enabled` flips to `false`.
  53. # See the comment for `matrix_static_files_file_index_html_enabled` to learn why.
  54. - content: "{{ matrix_static_files_file_index_html_template }}"
  55. dest: "{{ matrix_static_files_public_path }}/index.html"
  56. when: "{{ matrix_static_files_file_index_html_enabled }}"
  57. - name: Ensure /.well-known/matrix/server file deleted if not enabled
  58. ansible.builtin.file:
  59. path: "{{ matrix_static_files_public_well_known_matrix_path }}/server"
  60. state: absent
  61. when: "not matrix_static_files_file_matrix_server_enabled | bool"
  62. - name: Ensure /.well-known/matrix/support file deleted if not enabled
  63. ansible.builtin.file:
  64. path: "{{ matrix_static_files_public_well_known_matrix_path }}/support"
  65. state: absent
  66. when: "not matrix_static_files_file_matrix_support_enabled | bool"
  67. - name: Ensure /.well-known/element/element.json file deleted if not enabled
  68. ansible.builtin.file:
  69. path: "{{ matrix_static_files_public_well_known_element_path }}/element.json"
  70. state: absent
  71. when: "not matrix_static_files_file_element_element_json_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