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.
 
 

105 líneas
3.7 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_docker_image.split(':')[1] }}"
  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 }}"
  37. build:
  38. dockerfile: Dockerfile
  39. path: "{{ matrix_coturn_docker_src_files_path }}"
  40. pull: yes
  41. when: "matrix_coturn_container_image_self_build|bool"
  42. - name: Ensure Coturn configuration path exists
  43. file:
  44. path: "{{ matrix_coturn_base_path }}"
  45. state: directory
  46. mode: 0750
  47. owner: "{{ matrix_user_username }}"
  48. group: "{{ matrix_user_groupname }}"
  49. - name: Ensure turnserver.conf installed
  50. template:
  51. src: "{{ role_path }}/templates/turnserver.conf.j2"
  52. dest: "{{ matrix_coturn_config_path }}"
  53. mode: 0644
  54. owner: "{{ matrix_user_username }}"
  55. group: "{{ matrix_user_groupname }}"
  56. - name: Ensure Coturn network is created in Docker
  57. docker_network:
  58. name: "{{ matrix_coturn_docker_network }}"
  59. driver: bridge
  60. - name: Ensure matrix-coturn.service installed
  61. template:
  62. src: "{{ role_path }}/templates/systemd/matrix-coturn.service.j2"
  63. dest: "{{ matrix_systemd_path }}/matrix-coturn.service"
  64. mode: 0644
  65. register: matrix_coturn_systemd_service_change_results
  66. # This may be unnecessary when more long-lived certificates are used.
  67. # We optimize for the common use-case though (short-lived Let's Encrypt certificates).
  68. # Reloading doesn't hurt anyway, so there's no need to make this more flexible.
  69. - name: Ensure reloading systemd units installed, if necessary
  70. template:
  71. src: "{{ role_path }}/templates/systemd/{{ item }}.j2"
  72. dest: "{{ matrix_systemd_path }}/{{ item }}"
  73. mode: 0644
  74. register: "matrix_coturn_systemd_service_change_results"
  75. when: "matrix_coturn_tls_enabled|bool"
  76. with_items:
  77. - matrix-coturn-reload.service
  78. - matrix-coturn-reload.timer
  79. # A similar task exists in `setup_uninstall.yml`
  80. - name: Ensure reloading systemd units uninstalled, if unnecessary
  81. file:
  82. path: "{{ item }}"
  83. state: absent
  84. register: "matrix_coturn_systemd_service_change_results"
  85. when: "not matrix_coturn_tls_enabled|bool"
  86. with_items:
  87. - matrix-coturn-reload.service
  88. - matrix-coturn-reload.timer
  89. - name: Ensure systemd reloaded if systemd units changed
  90. service:
  91. daemon_reload: yes
  92. when: "matrix_coturn_systemd_service_change_results.changed"