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.
 
 

106 líneas
4.0 KiB

  1. ---
  2. # This is a cleanup/migration task. It can be removed some time in the future.
  3. - name: (Migration) Remove deprecated cronjob
  4. file:
  5. path: "{{ matrix_cron_path }}/matrix-coturn-ssl-reload"
  6. state: absent
  7. - name: Ensure Matrix Coturn path exists
  8. file:
  9. path: "{{ item.path }}"
  10. state: directory
  11. mode: 0750
  12. owner: "{{ matrix_user_username }}"
  13. group: "{{ matrix_user_groupname }}"
  14. with_items:
  15. - { path: "{{ matrix_coturn_docker_src_files_path }}", when: "{{ matrix_coturn_container_image_self_build }}"}
  16. when: "item.when|bool"
  17. - name: Ensure Coturn image is pulled
  18. docker_image:
  19. name: "{{ matrix_coturn_docker_image }}"
  20. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  21. force_source: "{{ matrix_coturn_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  22. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_coturn_docker_image_force_pull }}"
  23. when: "not matrix_coturn_container_image_self_build|bool"
  24. - block:
  25. - name: Ensure Coturn repository is present on self-build
  26. git:
  27. repo: "{{ matrix_coturn_container_image_self_build_repo }}"
  28. dest: "{{ matrix_coturn_docker_src_files_path }}"
  29. version: "{{ matrix_coturn_container_image_self_build_repo_version }}"
  30. force: "yes"
  31. register: matrix_coturn_git_pull_results
  32. - name: Ensure Coturn Docker image is built
  33. docker_image:
  34. name: "{{ matrix_coturn_docker_image }}"
  35. source: build
  36. force_source: "{{ matrix_coturn_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  37. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_coturn_git_pull_results.changed }}"
  38. build:
  39. dockerfile: "{{ matrix_coturn_container_image_self_build_repo_dockerfile_path }}"
  40. path: "{{ matrix_coturn_docker_src_files_path }}"
  41. pull: yes
  42. when: "matrix_coturn_container_image_self_build|bool"
  43. - name: Ensure Coturn configuration path exists
  44. file:
  45. path: "{{ matrix_coturn_base_path }}"
  46. state: directory
  47. mode: 0750
  48. owner: "{{ matrix_user_username }}"
  49. group: "{{ matrix_user_groupname }}"
  50. - name: Ensure turnserver.conf installed
  51. template:
  52. src: "{{ role_path }}/templates/turnserver.conf.j2"
  53. dest: "{{ matrix_coturn_config_path }}"
  54. mode: 0644
  55. owner: "{{ matrix_user_username }}"
  56. group: "{{ matrix_user_groupname }}"
  57. - name: Ensure Coturn network is created in Docker
  58. docker_network:
  59. name: "{{ matrix_coturn_docker_network }}"
  60. driver: bridge
  61. - name: Ensure matrix-coturn.service installed
  62. template:
  63. src: "{{ role_path }}/templates/systemd/matrix-coturn.service.j2"
  64. dest: "{{ matrix_systemd_path }}/matrix-coturn.service"
  65. mode: 0644
  66. register: matrix_coturn_systemd_service_change_results
  67. # This may be unnecessary when more long-lived certificates are used.
  68. # We optimize for the common use-case though (short-lived Let's Encrypt certificates).
  69. # Reloading doesn't hurt anyway, so there's no need to make this more flexible.
  70. - name: Ensure reloading systemd units installed, if necessary
  71. template:
  72. src: "{{ role_path }}/templates/systemd/{{ item }}.j2"
  73. dest: "{{ matrix_systemd_path }}/{{ item }}"
  74. mode: 0644
  75. register: "matrix_coturn_systemd_service_change_results"
  76. when: "matrix_coturn_tls_enabled|bool"
  77. with_items:
  78. - matrix-coturn-reload.service
  79. - matrix-coturn-reload.timer
  80. # A similar task exists in `setup_uninstall.yml`
  81. - name: Ensure reloading systemd units uninstalled, if unnecessary
  82. file:
  83. path: "{{ item }}"
  84. state: absent
  85. register: "matrix_coturn_systemd_service_change_results"
  86. when: "not matrix_coturn_tls_enabled|bool"
  87. with_items:
  88. - matrix-coturn-reload.service
  89. - matrix-coturn-reload.timer
  90. - name: Ensure systemd reloaded if systemd units changed
  91. service:
  92. daemon_reload: yes
  93. when: "matrix_coturn_systemd_service_change_results.changed"