From 45fb2df43f26f5740a9063a19942ca5a520211e1 Mon Sep 17 00:00:00 2001 From: Hugues Morisset Date: Sun, 2 Sep 2018 16:05:14 +0200 Subject: [PATCH] Fix some problem with permissions Fix typo Move mautrix variable in `defaults/main.yml` exclusively --- examples/host-vars.yml | 6 ------ roles/matrix-server/defaults/main.yml | 7 +++++-- .../tasks/setup_synapse_ext_mautrix_telegram.yml | 7 +++++-- .../templates/mautrix-telegram/config.yaml.j2 | 3 ++- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/examples/host-vars.yml b/examples/host-vars.yml index c5b82c8b..d0d1a41e 100644 --- a/examples/host-vars.yml +++ b/examples/host-vars.yml @@ -26,9 +26,3 @@ matrix_coturn_turn_static_auth_secret: "" # You can put any string here, but generating a strong one is preferred (e.g. `pwgen -s 64 1`). matrix_synapse_macaroon_secret_key: "" -# Mautrix telegram -# Enable telegram bridge -matrix_mautrix_telegram_enabled: false -# Get your own API keys at https://my.telegram.org/apps -matrix_mautrix_telegram_api_id: YOUR_TELEGRAM_APP_ID -matrix_mautrix_telegram_api_hash: YOUR_TELEGRAM_API_HASH diff --git a/roles/matrix-server/defaults/main.yml b/roles/matrix-server/defaults/main.yml index 19d8f59f..579df268 100644 --- a/roles/matrix-server/defaults/main.yml +++ b/roles/matrix-server/defaults/main.yml @@ -86,7 +86,7 @@ matrix_synapse_additional_loggers: [] # A list of service config files # This list gets populated dynamically based on Synapse extensions that have been enabled. -# Conatains fs paths +# Contains fs paths matrix_synapse_app_service_config_files: [] # This is set dynamically during execution depending on whether @@ -219,9 +219,12 @@ matrix_riot_web_enabled: true matrix_riot_web_default_identity_server_url: "https://{{ matrix_synapse_trusted_third_party_id_servers[0] }}" - # Matrix mautrix is a Matrix <-> Telegram bridge +# Enable telegram bridge matrix_mautrix_telegram_enabled: false +# Get your own API keys at https://my.telegram.org/apps +matrix_mautrix_telegram_api_id: YOUR_TELEGRAM_APP_ID +matrix_mautrix_telegram_api_hash: YOUR_TELEGRAM_API_HASH # By default, this playbook sets up its own nginx proxy server on port 80/443. diff --git a/roles/matrix-server/tasks/setup_synapse_ext_mautrix_telegram.yml b/roles/matrix-server/tasks/setup_synapse_ext_mautrix_telegram.yml index d0b1ec47..91882a8c 100644 --- a/roles/matrix-server/tasks/setup_synapse_ext_mautrix_telegram.yml +++ b/roles/matrix-server/tasks/setup_synapse_ext_mautrix_telegram.yml @@ -14,6 +14,9 @@ group: "{{ matrix_user_username }}" when: "matrix_mautrix_telegram_enabled" +- stat: "path={{ matrix_mautrix_telegram_base_path }}/config.yaml" + register: mautrix_config_file + - name: Ensure Matrix Mautrix telegram config installed template: src: "{{ role_path }}/templates/mautrix-telegram/config.yaml.j2" @@ -21,7 +24,7 @@ mode: 0644 owner: "{{ matrix_user_username }}" group: "{{ matrix_user_username }}" - when: "matrix_mautrix_telegram_enabled" + when: "matrix_mautrix_telegram_enabled and mautrix_config_file.stat.exists == False" - name: Ensure matrix-mautrix-telegram.service installed template: @@ -60,6 +63,6 @@ - name: Ensure matrix-mautrix-telegram.service doesn't exist file: - path: "{{ role_path }}/templates/systemd/matrix-mautrix-telegram.service.j2" + path: "{{ role_path }}/templates/systemd/matrix-mautrix-telegram.service" state: absent when: "not matrix_mautrix_telegram_enabled" diff --git a/roles/matrix-server/templates/mautrix-telegram/config.yaml.j2 b/roles/matrix-server/templates/mautrix-telegram/config.yaml.j2 index 11c80125..2f4afd55 100644 --- a/roles/matrix-server/templates/mautrix-telegram/config.yaml.j2 +++ b/roles/matrix-server/templates/mautrix-telegram/config.yaml.j2 @@ -206,7 +206,8 @@ bridge: # domain - All users on that homeserver # mxid - Specific user permissions: - "*": "puppeting" + '{{ hostname_identity }}': puppeting + '*': relaybot # Options related to the message relay Telegram bot. relaybot: