mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2024-12-12 08:43:55 +02:00
4299d4ebd5
* Inital work, copeid from mautrix-amp PR * Some fixes leftover code copeid over from whatsapp * Got it to run and register * Fixed service issue with docker image * I now realize I need 2 roles wsproxy and imessage * Got someting working, still rough * Closer to working but still not working * reverting ports * Update main.yml * Add matrix-nginx-proxy config for mautrix-wsproxy * Changed * Add back file * fix for error hopefully * Changed the the way nginx was recieved * basically did not add anything ugh * Added some arguments * just trying stuff now * Ugh i messed up port number * Changed docs * Change dns config * changed generic secret key * Testing new nginx proxy * test * Fix linting errors * Add mautrix syncproxy to wsproxy for Android SMS * WIP * Move wsproxy to custom * Squashed commit of the following: commit943189a9aa
Merge:4a229d68
f5a09f30
Author: Slavi Pantaleev <slavi@devture.com> Date: Sun Nov 13 08:54:32 2022 +0200 Merge pull request #2259 from throny/patch-3 warn users about upgrading to pg15 when using borg commit4a229d6870
Merge:9b326e08
c68def08
Author: Slavi Pantaleev <slavi@devture.com> Date: Sun Nov 13 08:53:13 2022 +0200 Merge pull request #2260 from etkecc/patch-117 Update ntfy 1.28.0 -> 1.29.0 commitf5a09f30b7
Author: throny <m.throne12@gmail.com> Date: Sat Nov 12 23:48:57 2022 +0100 Update maintenance-postgres.md commitb12cdbd99d
Author: throny <m.throne12@gmail.com> Date: Sat Nov 12 23:40:46 2022 +0100 Update maintenance-postgres.md commitc68def0809
Author: Aine <97398200+etkecc@users.noreply.github.com> Date: Sat Nov 12 22:01:31 2022 +0000 Update ntfy 1.28.0 -> 1.29.0 commitadbc09f152
Author: throny <m.throne12@gmail.com> Date: Sat Nov 12 11:20:43 2022 +0100 warn users about upgrading to pg15 when using borg * Fix linting errors * Cleanup after merge * Correct outdated variable names * Enable both Android and iMessage with wsproxy * Restructure wsproxy service defs and nginx config * Fix linter errors * Apply suggestions from code review Co-authored-by: Slavi Pantaleev <slavi@devture.com> * Fix comments for documentation, volumes and ports * Correct mount syntax * Complete network and traefik support for wsproxy * Remove wsproxy data_path * Fix wsproxy service definitions * Actually include syncproxy service * Remove wsproxy PathPrefix, it needs a subdomain There's no setting in the iMessage bridge that allows a path. Also don't bind port by default, wsproxy has no TLS. Syncproxy should never expose a port, it's only internal. --------- Co-authored-by: hanthor <jreilly112@gmail.com> Co-authored-by: Miguel Alatzar <miguel@natrx.io> Co-authored-by: Shreyas Ajjarapu <github.tzarina@aleeas.com> Co-authored-by: Slavi Pantaleev <slavi@devture.com>
122 lines
5.0 KiB
YAML
122 lines
5.0 KiB
YAML
---
|
|
|
|
# If the matrix-synapse role is not used, `matrix_synapse_role_executed` won't exist.
|
|
# We don't want to fail in such cases.
|
|
- name: Fail if matrix-synapse role already executed
|
|
ansible.builtin.fail:
|
|
msg: >-
|
|
The matrix-bridge-mautrix-wsproxy role needs to execute before the matrix-synapse role.
|
|
when: "matrix_synapse_role_executed|default(False)"
|
|
|
|
- ansible.builtin.set_fact:
|
|
matrix_mautrix_wsproxy_requires_restart: false
|
|
|
|
- ansible.builtin.set_fact:
|
|
matrix_mautrix_wsproxy_syncproxy_requires_restart: false
|
|
|
|
- name: Ensure Mautrix wsproxy support files installed
|
|
ansible.builtin.template:
|
|
src: "{{ role_path }}/templates/{{ item }}.j2"
|
|
dest: "{{ matrix_mautrix_wsproxy_base_path }}/{{ item }}"
|
|
mode: 0640
|
|
owner: "{{ matrix_user_username }}"
|
|
group: "{{ matrix_user_groupname }}"
|
|
with_items:
|
|
- syncproxy-env
|
|
- wsproxy-labels
|
|
|
|
- name: Ensure Mautrix wsproxy image is pulled
|
|
community.docker.docker_image:
|
|
name: "{{ matrix_mautrix_wsproxy_docker_image }}"
|
|
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
|
force_source: "{{ matrix_mautrix_wsproxy_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_mautrix_wsproxy_docker_image_force_pull }}"
|
|
|
|
- name: Ensure Mautrix syncproxy image is pulled
|
|
community.docker.docker_image:
|
|
name: "{{ matrix_mautrix_wsproxy_syncproxy_docker_image }}"
|
|
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
|
force_source: "{{ matrix_mautrix_wsproxy_syncproxy_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_mautrix_wsproxy_syncproxy_docker_image_force_pull }}"
|
|
|
|
- name: Ensure Mautrix wsproxy paths exists
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
mode: 0750
|
|
owner: "{{ matrix_user_username }}"
|
|
group: "{{ matrix_user_groupname }}"
|
|
with_items:
|
|
- "{{ matrix_mautrix_wsproxy_base_path }}"
|
|
- "{{ matrix_mautrix_wsproxy_config_path }}"
|
|
|
|
- name: Check if an old matrix state file exists
|
|
ansible.builtin.stat:
|
|
path: "{{ matrix_mautrix_wsproxy_base_path }}/mx-state.json"
|
|
register: matrix_mautrix_wsproxy_stat_mx_state
|
|
|
|
- name: Ensure mautrix-wsproxy config.yaml installed
|
|
ansible.builtin.copy:
|
|
content: "{{ matrix_mautrix_wsproxy_configuration|to_nice_yaml }}"
|
|
dest: "{{ matrix_mautrix_wsproxy_config_path }}/config.yaml"
|
|
mode: 0644
|
|
owner: "{{ matrix_user_username }}"
|
|
group: "{{ matrix_user_groupname }}"
|
|
|
|
- name: Ensure mautrix-androidsms registration.yaml installed
|
|
ansible.builtin.copy:
|
|
content: "{{ matrix_mautrix_androidsms_registration|to_nice_yaml }}"
|
|
dest: "{{ matrix_mautrix_wsproxy_config_path }}/androidsms-registration.yaml"
|
|
mode: 0644
|
|
owner: "{{ matrix_user_username }}"
|
|
group: "{{ matrix_user_groupname }}"
|
|
|
|
- name: Ensure mautrix-imessage registration.yaml installed
|
|
ansible.builtin.copy:
|
|
content: "{{ matrix_mautrix_imessage_registration|to_nice_yaml }}"
|
|
dest: "{{ matrix_mautrix_wsproxy_config_path }}/imessage-registration.yaml"
|
|
mode: 0644
|
|
owner: "{{ matrix_user_username }}"
|
|
group: "{{ matrix_user_groupname }}"
|
|
|
|
- name: Ensure mautrix-wsproxy container network is created
|
|
community.general.docker_network:
|
|
name: "{{ matrix_mautrix_wsproxy_container_network }}"
|
|
driver: bridge
|
|
|
|
- name: Ensure matrix-mautrix-wsproxy.service installed
|
|
ansible.builtin.template:
|
|
src: "{{ role_path }}/templates/systemd/matrix-mautrix-wsproxy.service.j2"
|
|
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-mautrix-wsproxy.service"
|
|
mode: 0644
|
|
register: matrix_mautrix_wsproxy_systemd_service_result
|
|
|
|
- name: Ensure systemd reloaded after matrix-mautrix-wsproxy.service installation
|
|
ansible.builtin.service:
|
|
daemon_reload: true
|
|
when: "matrix_mautrix_wsproxy_systemd_service_result.changed"
|
|
|
|
- name: Ensure matrix-mautrix-wsproxy.service restarted, if necessary
|
|
ansible.builtin.service:
|
|
name: "matrix-mautrix-wsproxy.service"
|
|
state: restarted
|
|
when: "matrix_mautrix_wsproxy_requires_restart|bool"
|
|
|
|
- name: Ensure matrix-mautrix-wsproxy-syncproxy.service installed
|
|
ansible.builtin.template:
|
|
src: "{{ role_path }}/templates/systemd/matrix-mautrix-wsproxy-syncproxy.service.j2"
|
|
dest: "{{ devture_systemd_docker_base_systemd_path }}/matrix-mautrix-wsproxy-syncproxy.service"
|
|
mode: 0644
|
|
register: matrix_mautrix_wsproxy_syncproxy_systemd_service_result
|
|
|
|
- name: Ensure systemd reloaded after matrix-mautrix-wsproxy-syncproxy.service installation
|
|
ansible.builtin.service:
|
|
daemon_reload: true
|
|
when: "matrix_mautrix_wsproxy_syncproxy_systemd_service_result.changed"
|
|
|
|
- name: Ensure matrix-mautrix-wsproxy-syncproxy.service restarted, if necessary
|
|
ansible.builtin.service:
|
|
name: "matrix-mautrix-wsproxy-syncproxy.service"
|
|
state: restarted
|
|
when: "matrix_mautrix_wsproxy_syncproxy_requires_restart|bool"
|