Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

80 строки
2.1 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. when: matrix_coturn_enabled
  29. - name: Allow access to Coturn ports in firewalld
  30. firewalld:
  31. port: "{{ item }}"
  32. state: enabled
  33. immediate: yes
  34. permanent: yes
  35. with_items:
  36. - '3478/tcp' # STUN
  37. - '3478/udp' # STUN
  38. - "{{ matrix_coturn_turn_udp_min_port }}-{{ matrix_coturn_turn_udp_max_port }}/udp" # TURN
  39. when: "matrix_coturn_enabled and ansible_os_family == 'RedHat'"
  40. #
  41. # Tasks related to getting rid of Coturn (if it was previously enabled)
  42. #
  43. - name: Check existence of matrix-coturn service
  44. stat:
  45. path: "/etc/systemd/system/matrix-coturn.service"
  46. register: matrix_coturn_service_stat
  47. - name: Ensure matrix-coturn is stopped
  48. service:
  49. name: matrix-coturn
  50. state: stopped
  51. daemon_reload: yes
  52. register: stopping_result
  53. when: "not matrix_coturn_enabled and matrix_coturn_service_stat.stat.exists"
  54. - name: Ensure matrix-coturn.service doesn't exist
  55. file:
  56. path: "/etc/systemd/system/matrix-coturn.service"
  57. state: absent
  58. when: "not matrix_coturn_enabled and matrix_coturn_service_stat.stat.exists"
  59. - name: Ensure Matrix coturn paths don't exist
  60. file:
  61. path: "{{ matrix_coturn_base_path }}"
  62. state: absent
  63. when: "not matrix_coturn_enabled"
  64. - name: Ensure coturn Docker image doesn't exist
  65. docker_image:
  66. name: "{{ matrix_coturn_docker_image }}"
  67. state: absent
  68. when: "not matrix_coturn_enabled"