From 7c4a86bc6b835eb7e30787f7fc4bef1853510b7d Mon Sep 17 00:00:00 2001 From: Horvath Gergely Date: Wed, 19 Feb 2020 22:18:17 +0100 Subject: [PATCH] add coturn support for raspberry pi --- roles/matrix-base/defaults/main.yml | 1 + roles/matrix-base/tasks/setup_matrix_base.yml | 5 +++-- roles/matrix-coturn/tasks/setup_coturn.yml | 20 ++++++++++++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/roles/matrix-base/defaults/main.yml b/roles/matrix-base/defaults/main.yml index b5897d0d1..6dd986e3a 100644 --- a/roles/matrix-base/defaults/main.yml +++ b/roles/matrix-base/defaults/main.yml @@ -28,6 +28,7 @@ matrix_base_data_path_mode: "750" matrix_static_files_base_path: "{{ matrix_base_data_path }}/static-files" matrix_docker_src_files_path: "{{ matrix_base_data_path }}/docker-src" matrix_docker_synapse_src_files_path: "{{ matrix_docker_src_files_path }}/synapse" +matrix_docker_coturn_src_files_path: "{{ matrix_docker_src_files_path }}/coturn" matrix_homeserver_url: "https://{{ matrix_server_fqn_matrix }}" diff --git a/roles/matrix-base/tasks/setup_matrix_base.yml b/roles/matrix-base/tasks/setup_matrix_base.yml index 952a37a5d..fcf0300e8 100644 --- a/roles/matrix-base/tasks/setup_matrix_base.yml +++ b/roles/matrix-base/tasks/setup_matrix_base.yml @@ -22,8 +22,9 @@ group: "{{ matrix_user_username }}" with_items: - "{{ matrix_base_data_path }}" - - "{{ matrix_docker_src_files_path }}" - - "{{ matrix_docker_synapse_src_files_path }}" + - { src: "{{ matrix_docker_src_files_path }}", when: "{{ matrix_raspberry_pi }}" } + - { src: "{{ matrix_docker_synapse_src_files_path }}", when: "{{ matrix_raspberry_pi }}" } + - { src: "{{ matrix_docker_coturn_src_files_path }}", when: "{{ matrix_coturn_enabled }}"} # `docker_network` doesn't work as expected when the given network # is a substring of a network that already exists. diff --git a/roles/matrix-coturn/tasks/setup_coturn.yml b/roles/matrix-coturn/tasks/setup_coturn.yml index eaa29aa58..9cbf6f033 100644 --- a/roles/matrix-coturn/tasks/setup_coturn.yml +++ b/roles/matrix-coturn/tasks/setup_coturn.yml @@ -10,7 +10,25 @@ source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" force_source: "{{ matrix_coturn_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_coturn_docker_image_force_pull }}" - when: matrix_coturn_enabled|bool + when: matrix_coturn_enabled|bool and not matrix_raspberry_pi + +- name: Ensure Coturn repository is present on Raspberry pi + git: + repo: https://github.com/instrumentisto/coturn-docker-image.git + dest: "{{ matrix_docker_coturn_src_files_path }}" + version: "{{ matrix_coturn_docker_image.split(':')[1] }}" + force: "yes" + when: "matrix_raspberry_pi" + +- name: Ensure Coturn Docker image is build (Raspberry pi) + docker_image: + name: "{{ matrix_coturn_docker_image }}" + source: build + build: + dockerfile: Dockerfile + path: "{{ matrix_docker_coturn_src_files_path }}" + pull: yes + when: "matrix_raspberry_pi" - name: Ensure Coturn configuration path exists file: