Matrix Docker Ansible eploy
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

93 righe
2.6 KiB

  1. ---
  2. #
  3. # Tasks related to setting up Coturn
  4. #
  5. - name: Ensure Coturn image is pulled
  6. docker_image:
  7. name: "{{ matrix_coturn_docker_image }}"
  8. when: matrix_coturn_enabled
  9. - name: Ensure Coturn configuration path exists
  10. file:
  11. path: "{{ matrix_coturn_base_path }}"
  12. state: directory
  13. mode: 0750
  14. owner: "{{ matrix_user_username }}"
  15. group: "{{ matrix_user_username }}"
  16. when: matrix_coturn_enabled
  17. - name: Ensure turnserver.conf installed
  18. template:
  19. src: "{{ role_path }}/templates/turnserver.conf.j2"
  20. dest: "{{ matrix_coturn_config_path }}"
  21. mode: 0644
  22. when: matrix_coturn_enabled
  23. - name: Ensure matrix-coturn.service installed
  24. template:
  25. src: "{{ role_path }}/templates/systemd/matrix-coturn.service.j2"
  26. dest: "/etc/systemd/system/matrix-coturn.service"
  27. mode: 0644
  28. register: matrix_coturn_systemd_service_result
  29. when: matrix_coturn_enabled
  30. - name: Ensure systemd reloaded after matrix-coturn.service installation
  31. service:
  32. daemon_reload: yes
  33. when: "matrix_coturn_enabled and matrix_coturn_systemd_service_result.changed"
  34. - name: Allow access to Coturn ports in firewalld
  35. firewalld:
  36. port: "{{ item }}"
  37. state: enabled
  38. immediate: yes
  39. permanent: yes
  40. with_items:
  41. - '3478/tcp' # STUN
  42. - '3478/udp' # STUN
  43. - "{{ matrix_coturn_turn_udp_min_port }}-{{ matrix_coturn_turn_udp_max_port }}/udp" # TURN
  44. when: "matrix_coturn_enabled and ansible_os_family == 'RedHat'"
  45. #
  46. # Tasks related to getting rid of Coturn (if it was previously enabled)
  47. #
  48. - name: Check existence of matrix-coturn service
  49. stat:
  50. path: "/etc/systemd/system/matrix-coturn.service"
  51. register: matrix_coturn_service_stat
  52. when: "not matrix_coturn_enabled"
  53. - name: Ensure matrix-coturn is stopped
  54. service:
  55. name: matrix-coturn
  56. state: stopped
  57. daemon_reload: yes
  58. register: stopping_result
  59. when: "not matrix_coturn_enabled and matrix_coturn_service_stat.stat.exists"
  60. - name: Ensure matrix-coturn.service doesn't exist
  61. file:
  62. path: "/etc/systemd/system/matrix-coturn.service"
  63. state: absent
  64. when: "not matrix_coturn_enabled and matrix_coturn_service_stat.stat.exists"
  65. - name: Ensure systemd reloaded after matrix-coturn.service removal
  66. service:
  67. daemon_reload: yes
  68. when: "not matrix_coturn_enabled and matrix_coturn_service_stat.stat.exists"
  69. - name: Ensure Matrix coturn paths don't exist
  70. file:
  71. path: "{{ matrix_coturn_base_path }}"
  72. state: absent
  73. when: "not matrix_coturn_enabled"
  74. - name: Ensure coturn Docker image doesn't exist
  75. docker_image:
  76. name: "{{ matrix_coturn_docker_image }}"
  77. state: absent
  78. when: "not matrix_coturn_enabled"