| @@ -678,3 +678,19 @@ matrix_synapse_systemd_wanted_services_list: | | |||||
| # /matrix-synapse | # /matrix-synapse | ||||
| # | # | ||||
| ###################################################################### | ###################################################################### | ||||
| ###################################################################### | |||||
| # | |||||
| # raspberry pi | |||||
| # | |||||
| ###################################################################### | |||||
| matrix_raspberry_pi: "false" | |||||
| ###################################################################### | |||||
| # | |||||
| # /raspberry pi | |||||
| # | |||||
| ###################################################################### | |||||
| @@ -26,6 +26,8 @@ matrix_base_data_path: "/matrix" | |||||
| matrix_base_data_path_mode: "750" | matrix_base_data_path_mode: "750" | ||||
| matrix_static_files_base_path: "{{ matrix_base_data_path }}/static-files" | 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_homeserver_url: "https://{{ matrix_server_fqn_matrix }}" | matrix_homeserver_url: "https://{{ matrix_server_fqn_matrix }}" | ||||
| @@ -44,3 +44,10 @@ | |||||
| - "{{ matrix_server_fqn_matrix }}" | - "{{ matrix_server_fqn_matrix }}" | ||||
| - "{{ matrix_server_fqn_riot }}" | - "{{ matrix_server_fqn_riot }}" | ||||
| when: "item != item|lower" | when: "item != item|lower" | ||||
| # ansible lower than 2.8, does not support docker_image build parameters | |||||
| # for Raspberry pi it is explicitly needed, so we rather fail here | |||||
| - name: Fail if running on Ansible lower than 2.8 and targeting Raspberry pi | |||||
| fail: | |||||
| msg: "To target Raspberry pi, you should usa ansible 2.8 or higher. E.g. pip contains such packages." | |||||
| when: "ansible_version.major == 2 and ansible_version.minor < 8 and matrix_raspberry_pi" | |||||
| @@ -4,10 +4,10 @@ | |||||
| when: ansible_distribution == 'CentOS' | when: ansible_distribution == 'CentOS' | ||||
| - include_tasks: "{{ role_path }}/tasks/server_base/setup_debian.yml" | - include_tasks: "{{ role_path }}/tasks/server_base/setup_debian.yml" | ||||
| when: (ansible_os_family == 'Debian') and (ansible_lsb.id != 'Raspbian') | |||||
| when: (ansible_os_family == 'Debian') and (ansible_lsb.id != 'Raspbian') | |||||
| - include_tasks: "{{ role_path }}/tasks/server_base/setup_raspbian.yml" | - include_tasks: "{{ role_path }}/tasks/server_base/setup_raspbian.yml" | ||||
| when: (ansible_os_family == 'Debian') and (ansible_lsb.id == 'Raspbian') | |||||
| when: "matrix_raspberry_pi" | |||||
| - name: Ensure Docker is started and autoruns | - name: Ensure Docker is started and autoruns | ||||
| service: | service: | ||||
| @@ -22,6 +22,8 @@ | |||||
| group: "{{ matrix_user_username }}" | group: "{{ matrix_user_username }}" | ||||
| with_items: | with_items: | ||||
| - "{{ matrix_base_data_path }}" | - "{{ matrix_base_data_path }}" | ||||
| - "{{ matrix_docker_src_files_path }}" | |||||
| - "{{ matrix_docker_synapse_src_files_path }}" | |||||
| # `docker_network` doesn't work as expected when the given network | # `docker_network` doesn't work as expected when the given network | ||||
| # is a substring of a network that already exists. | # is a substring of a network that already exists. | ||||
| @@ -18,12 +18,31 @@ | |||||
| group: "{{ matrix_user_username }}" | group: "{{ matrix_user_username }}" | ||||
| when: "not local_path_media_store_stat.failed and not local_path_media_store_stat.stat.exists" | when: "not local_path_media_store_stat.failed and not local_path_media_store_stat.stat.exists" | ||||
| - name: Ensure Synapse repository is present on Raspberry pi | |||||
| git: | |||||
| repo: https://github.com/matrix-org/synapse.git | |||||
| dest: "{{ matrix_docker_synapse_src_files_path }}" | |||||
| version: "{{ matrix_synapse_docker_image.split(':')[1] }}" | |||||
| force: "yes" | |||||
| when: "matrix_raspberry_pi" | |||||
| - name: Ensure Synapse Docker image is build (Raspberry pi) | |||||
| docker_image: | |||||
| name: "{{ matrix_synapse_docker_image }}" | |||||
| source: build | |||||
| build: | |||||
| dockerfile: docker/Dockerfile | |||||
| path: "{{ matrix_docker_synapse_src_files_path }}" | |||||
| pull: yes | |||||
| when: "matrix_raspberry_pi" | |||||
| - name: Ensure Synapse Docker image is pulled | - name: Ensure Synapse Docker image is pulled | ||||
| docker_image: | docker_image: | ||||
| name: "{{ matrix_synapse_docker_image }}" | name: "{{ matrix_synapse_docker_image }}" | ||||
| source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" | source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" | ||||
| force_source: "{{ matrix_synapse_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" | force_source: "{{ matrix_synapse_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_synapse_docker_image_force_pull }}" | force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_synapse_docker_image_force_pull }}" | ||||
| when: "not matrix_raspberry_pi" | |||||
| - name: Check if a Synapse signing key exists | - name: Check if a Synapse signing key exists | ||||
| stat: | stat: | ||||