Merge pull request #179 from spantaleev/separate-bridge-roles
Move bridges into separate roles
This commit is contained in:
commit
3ece9375c6
22
CHANGELOG.md
22
CHANGELOG.md
|
@ -1,3 +1,25 @@
|
||||||
|
# 2019-05-21
|
||||||
|
|
||||||
|
## Synapse no longer required
|
||||||
|
|
||||||
|
The playbook no longer insists on installing [Synapse](https://github.com/matrix-org/synapse) via the `matrix-synapse` role.
|
||||||
|
|
||||||
|
If you would prefer to install Synapse another way and just use the playbook to install other services, it should be possible (`matrix_synapse_enabled: false`).
|
||||||
|
|
||||||
|
Note that it won't necessarily be the best experience, since the playbook wires things to Synapse by default.
|
||||||
|
If you're using your own Synapse instance (especially one not running in a container), you may have to override many variables to point them to the correct place.
|
||||||
|
|
||||||
|
Having Synapse not be a required component potentially opens the door for installing alternative Matrix homeservers.
|
||||||
|
|
||||||
|
|
||||||
|
## Bridges are now separate from the Synapse role
|
||||||
|
|
||||||
|
Bridges are no longer part of the `matrix-synapse` role.
|
||||||
|
Each bridge now lives in its own separate role (`roles/matrix-bridge-*`).
|
||||||
|
|
||||||
|
These bridge roles are independent of the `matrix-synapse` role, so it should be possible to use them with a Synapse instance installed another way (not through the playbook).
|
||||||
|
|
||||||
|
|
||||||
# 2019-05-09
|
# 2019-05-09
|
||||||
|
|
||||||
Besides a myriad of bug fixes and minor improvements, here are the more notable (bigger) features we can announce today.
|
Besides a myriad of bug fixes and minor improvements, here are the more notable (bigger) features we can announce today.
|
||||||
|
|
|
@ -8,7 +8,7 @@ That is, it lets you join the Matrix network with your own `@<username>:<your-do
|
||||||
|
|
||||||
Using this playbook, you can get the following services configured on your server:
|
Using this playbook, you can get the following services configured on your server:
|
||||||
|
|
||||||
- a [Synapse](https://github.com/matrix-org/synapse) homeserver - storing your data and managing your presence in the [Matrix](http://matrix.org/) network
|
- (optional, default) a [Synapse](https://github.com/matrix-org/synapse) homeserver - storing your data and managing your presence in the [Matrix](http://matrix.org/) network
|
||||||
|
|
||||||
- (optional) [Amazon S3](https://aws.amazon.com/s3/) storage for Synapse's content repository (`media_store`) files using [Goofys](https://github.com/kahing/goofys)
|
- (optional) [Amazon S3](https://aws.amazon.com/s3/) storage for Synapse's content repository (`media_store`) files using [Goofys](https://github.com/kahing/goofys)
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ When updating the playbook, refer to [the changelog](CHANGELOG.md) to catch up w
|
||||||
|
|
||||||
This playbook sets up your server using the following Docker images:
|
This playbook sets up your server using the following Docker images:
|
||||||
|
|
||||||
- [matrixdotorg/synapse](https://hub.docker.com/r/matrixdotorg/synapse/) - the official [Synapse](https://github.com/matrix-org/synapse) Matrix homeserver
|
- [matrixdotorg/synapse](https://hub.docker.com/r/matrixdotorg/synapse/) - the official [Synapse](https://github.com/matrix-org/synapse) Matrix homeserver (optional)
|
||||||
|
|
||||||
- [instrumentisto/coturn](https://hub.docker.com/r/instrumentisto/coturn/) - the [Coturn](https://github.com/coturn/coturn) STUN/TURN server (optional)
|
- [instrumentisto/coturn](https://hub.docker.com/r/instrumentisto/coturn/) - the [Coturn](https://github.com/coturn/coturn) STUN/TURN server (optional)
|
||||||
|
|
||||||
|
|
|
@ -9,28 +9,6 @@
|
||||||
# You can also override ANY variable (seen here or in any given role),
|
# You can also override ANY variable (seen here or in any given role),
|
||||||
# by re-defining it in your own configuration file (`inventory/host_vars/matrix.<your-domain>`).
|
# by re-defining it in your own configuration file (`inventory/host_vars/matrix.<your-domain>`).
|
||||||
|
|
||||||
######################################################################
|
|
||||||
#
|
|
||||||
# matrix-appservice-irc
|
|
||||||
#
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
# Normally, matrix-nginx-proxy is enabled and nginx can reach matrix-appservice-irc over the container network.
|
|
||||||
# If matrix-nginx-proxy is not enabled, or you otherwise have a need for it, you can expose
|
|
||||||
# matrix-appservice-irc's client-server port to the local host (`127.0.0.1:9999`).
|
|
||||||
matrix_appservice_irc_container_expose_client_server_api_port: "{{ not matrix_nginx_proxy_enabled }}"
|
|
||||||
|
|
||||||
######################################################################
|
|
||||||
#
|
|
||||||
# matrix-appservice-discord
|
|
||||||
#
|
|
||||||
######################################################################
|
|
||||||
|
|
||||||
# Normally, matrix-nginx-proxy is enabled and nginx can reach matrix-appservice-discord over the container network.
|
|
||||||
# If matrix-nginx-proxy is not enabled, or you otherwise have a need for it, you can expose
|
|
||||||
# matrix-appservice-discord's client-server port to the local host (`127.0.0.1:9005`).
|
|
||||||
matrix_appservice_discord_container_expose_client_server_api_port: "{{ not matrix_nginx_proxy_enabled }}"
|
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
|
@ -40,7 +18,6 @@ matrix_appservice_discord_container_expose_client_server_api_port: "{{ not matri
|
||||||
|
|
||||||
matrix_identity_server_url: "{{ 'https://' + matrix_synapse_trusted_third_party_id_servers[0] if matrix_synapse_trusted_third_party_id_servers|length > 0 else None }}"
|
matrix_identity_server_url: "{{ 'https://' + matrix_synapse_trusted_third_party_id_servers[0] if matrix_synapse_trusted_third_party_id_servers|length > 0 else None }}"
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
# /matrix-base
|
# /matrix-base
|
||||||
|
@ -48,6 +25,107 @@ matrix_identity_server_url: "{{ 'https://' + matrix_synapse_trusted_third_party_
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
#
|
||||||
|
# matrix-bridge-appservice-discord
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
# We don't enable bridges by default.
|
||||||
|
matrix_appservice_discord_enabled: false
|
||||||
|
|
||||||
|
# Normally, matrix-nginx-proxy is enabled and nginx can reach matrix-appservice-discord over the container network.
|
||||||
|
# If matrix-nginx-proxy is not enabled, or you otherwise have a need for it, you can expose
|
||||||
|
# matrix-appservice-discord's client-server port to the local host (`127.0.0.1:9005`).
|
||||||
|
matrix_appservice_discord_container_expose_client_server_api_port: "{{ not matrix_nginx_proxy_enabled }}"
|
||||||
|
|
||||||
|
matrix_appservice_discord_systemd_required_services_list: ['docker.service', 'matrix-synapse.service']
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
#
|
||||||
|
# /matrix-bridge-appservice-discord
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
#
|
||||||
|
# matrix-bridge-appservice-irc
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
# We don't enable bridges by default.
|
||||||
|
matrix_appservice_irc_enabled: false
|
||||||
|
|
||||||
|
# Normally, matrix-nginx-proxy is enabled and nginx can reach matrix-appservice-irc over the container network.
|
||||||
|
# If matrix-nginx-proxy is not enabled, or you otherwise have a need for it, you can expose
|
||||||
|
# matrix-appservice-irc's client-server port to the local host (`127.0.0.1:9999`).
|
||||||
|
matrix_appservice_irc_container_expose_client_server_api_port: "{{ not matrix_nginx_proxy_enabled }}"
|
||||||
|
|
||||||
|
matrix_appservice_irc_systemd_required_services_list: ['docker.service', 'matrix-synapse.service']
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
#
|
||||||
|
# /matrix-bridge-appservice-irc
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
#
|
||||||
|
# matrix-bridge-mautrix-facebook
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
# We don't enable bridges by default.
|
||||||
|
matrix_mautrix_facebook_enabled: false
|
||||||
|
|
||||||
|
matrix_mautrix_facebook_systemd_required_services_list: ['docker.service', 'matrix-synapse.service']
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
#
|
||||||
|
# /matrix-bridge-mautrix-facebook
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
#
|
||||||
|
# matrix-bridge-mautrix-telegram
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
# We don't enable bridges by default.
|
||||||
|
matrix_mautrix_telegram_enabled: false
|
||||||
|
|
||||||
|
matrix_mautrix_telegram_systemd_required_services_list: ['docker.service', 'matrix-synapse.service']
|
||||||
|
|
||||||
|
matrix_mautrix_telegram_public_endpoint: "/{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'telegram') | to_uuid }}"
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
#
|
||||||
|
# /matrix-bridge-mautrix-telegram
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
#
|
||||||
|
# matrix-bridge-mautrix-whatsapp
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
# We don't enable bridges by default.
|
||||||
|
matrix_mautrix_whatsapp_enabled: false
|
||||||
|
|
||||||
|
matrix_mautrix_whatsapp_systemd_required_services_list: ['docker.service', 'matrix-synapse.service']
|
||||||
|
|
||||||
|
######################################################################
|
||||||
|
#
|
||||||
|
# /matrix-bridge-mautrix-whatsapp
|
||||||
|
#
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
#
|
#
|
||||||
|
|
131
roles/matrix-bridge-appservice-discord/defaults/main.yml
Normal file
131
roles/matrix-bridge-appservice-discord/defaults/main.yml
Normal file
|
@ -0,0 +1,131 @@
|
||||||
|
# matrix-appservice-discord is a Matrix <-> Discord bridge
|
||||||
|
# See: https://github.com/Half-Shot/matrix-appservice-discord
|
||||||
|
|
||||||
|
matrix_appservice_discord_enabled: true
|
||||||
|
|
||||||
|
matrix_appservice_discord_docker_image: "halfshot/matrix-appservice-discord:latest"
|
||||||
|
|
||||||
|
matrix_appservice_discord_base_path: "{{ matrix_base_data_path }}/appservice-discord"
|
||||||
|
|
||||||
|
# Get your own keys at https://discordapp.com/developers/applications/me/create
|
||||||
|
matrix_appservice_discord_client_id: ''
|
||||||
|
matrix_appservice_discord_bot_token: ''
|
||||||
|
|
||||||
|
# Controls whether the Appservice Discord container exposes the Client/Server API port (tcp/9005).
|
||||||
|
matrix_appservice_discord_container_expose_client_server_api_port: false
|
||||||
|
|
||||||
|
# A list of extra arguments to pass to the container
|
||||||
|
matrix_appservice_discord_container_extra_arguments: []
|
||||||
|
|
||||||
|
# List of systemd services that matrix-appservice-discord.service depends on.
|
||||||
|
matrix_appservice_discord_systemd_required_services_list: ['docker.service']
|
||||||
|
|
||||||
|
# List of systemd services that matrix-appservice-discord.service wants
|
||||||
|
matrix_appservice_discord_systemd_wanted_services_list: []
|
||||||
|
|
||||||
|
matrix_appservice_discord_configuration_yaml: |
|
||||||
|
bridge:
|
||||||
|
domain: "{{ matrix_domain }}"
|
||||||
|
homeserverUrl: "{{ matrix_homeserver_url }}"
|
||||||
|
auth:
|
||||||
|
clientID: "{{matrix_appservice_discord_client_id}}"
|
||||||
|
botToken: "{{matrix_appservice_discord_bot_token}}"
|
||||||
|
database:
|
||||||
|
filename: "/data/discord.db"
|
||||||
|
userStorePath: "/data/user-store.db"
|
||||||
|
roomStorePath: "/data/room-store.db"
|
||||||
|
|
||||||
|
matrix_appservice_discord_configuration_extension_yaml: |
|
||||||
|
# This is a sample of the config file showing all avaliable options.
|
||||||
|
# Where possible we have documented what they do, and all values are the
|
||||||
|
# default values.
|
||||||
|
#
|
||||||
|
#bridge:
|
||||||
|
# # Domain part of the bridge, e.g. matrix.org
|
||||||
|
# domain: "localhost"
|
||||||
|
# # This should be your publically facing URL because Discord may use it to
|
||||||
|
# # fetch media from the media store.
|
||||||
|
# homeserverUrl: "http://localhost:8008"
|
||||||
|
# # Interval at which to process users in the 'presence queue'. If you have
|
||||||
|
# # 5 users, one user will be processed every 500 milliseconds according to the
|
||||||
|
# # value below. This has a minimum value of 250.
|
||||||
|
# # WARNING: This has a high chance of spamming the homeserver with presence
|
||||||
|
# # updates since it will send one each time somebody changes state or is online.
|
||||||
|
# presenceInterval: 500
|
||||||
|
# # Disable setting presence for 'ghost users' which means Discord users on Matrix
|
||||||
|
# # will not be shown as away or online.
|
||||||
|
# disablePresence: false
|
||||||
|
# # Disable sending typing notifications when somebody on Discord types.
|
||||||
|
# disableTypingNotifications: false
|
||||||
|
# # Disable deleting messages on Discord if a message is redacted on Matrix.
|
||||||
|
# disableDeletionForwarding: false
|
||||||
|
# # Enable users to bridge rooms using !discord commands. See
|
||||||
|
# # https://t2bot.io/discord for instructions.
|
||||||
|
# enableSelfServiceBridging: false
|
||||||
|
# # Disable sending of read receipts for Matrix events which have been
|
||||||
|
# # successfully bridged to Discord.
|
||||||
|
# disableReadReceipts: false
|
||||||
|
# Authentication configuration for the discord bot.
|
||||||
|
#auth:
|
||||||
|
# clientID: "12345"
|
||||||
|
# botToken: "foobar"
|
||||||
|
#logging:
|
||||||
|
# # What level should the logger output to the console at.
|
||||||
|
# console: "warn" #silly, verbose, info, http, warn, error, silent
|
||||||
|
# lineDateFormat: "MMM-D HH:mm:ss.SSS" # This is in moment.js format
|
||||||
|
# files:
|
||||||
|
# - file: "debug.log"
|
||||||
|
# disable:
|
||||||
|
# - "PresenceHandler" # Will not capture presence logging
|
||||||
|
# - file: "warn.log" # Will capture warnings
|
||||||
|
# level: "warn"
|
||||||
|
# - file: "botlogs.log" # Will capture logs from DiscordBot
|
||||||
|
# level: "info"
|
||||||
|
# enable:
|
||||||
|
# - "DiscordBot"
|
||||||
|
#database:
|
||||||
|
# userStorePath: "user-store.db"
|
||||||
|
# roomStorePath: "room-store.db"
|
||||||
|
# # You may either use SQLite or Postgresql for the bridge database, which contains
|
||||||
|
# # important mappings for events and user puppeting configurations.
|
||||||
|
# # Use the filename option for SQLite, or connString for Postgresql.
|
||||||
|
# # If you are migrating, see https://github.com/Half-Shot/matrix-appservice-discord/blob/master/docs/howto.md#migrate-to-postgres-from-sqlite
|
||||||
|
# # WARNING: You will almost certainly be fine with sqlite unless your bridge
|
||||||
|
# # is in heavy demand and you suffer from IO slowness.
|
||||||
|
# filename: "discord.db"
|
||||||
|
# # connString: "postgresql://user:password@localhost/database_name"
|
||||||
|
#room:
|
||||||
|
# # Set the default visibility of alias rooms, defaults to "public".
|
||||||
|
# # One of: "public", "private"
|
||||||
|
# defaultVisibility: "public"
|
||||||
|
#channel:
|
||||||
|
# # Pattern of the name given to bridged rooms.
|
||||||
|
# # Can use :guild for the guild name and :name for the channel name.
|
||||||
|
# namePattern: "[Discord] :guild :name"
|
||||||
|
# # Changes made to rooms when a channel is deleted.
|
||||||
|
# deleteOptions:
|
||||||
|
# # Prefix the room name with a string.
|
||||||
|
# #namePrefix: "[Deleted]"
|
||||||
|
# # Prefix the room topic with a string.
|
||||||
|
# #topicPrefix: "This room has been deleted"
|
||||||
|
# # Disable people from talking in the room by raising the event PL to 50
|
||||||
|
# disableMessaging: false
|
||||||
|
# # Remove the discord alias from the room.
|
||||||
|
# unsetRoomAlias: true
|
||||||
|
# # Remove the room from the directory.
|
||||||
|
# unlistFromDirectory: true
|
||||||
|
# # Set the room to be unavaliable for joining without an invite.
|
||||||
|
# setInviteOnly: true
|
||||||
|
# # Make all the discord users leave the room.
|
||||||
|
# ghostsLeave: true
|
||||||
|
#limits:
|
||||||
|
# # Delay in milliseconds between discord users joining a room.
|
||||||
|
# roomGhostJoinDelay: 6000
|
||||||
|
# # Delay in milliseconds before sending messages to discord to avoid echos.
|
||||||
|
# # (Copies of a sent message may arrive from discord before we've
|
||||||
|
# # fininished handling it, causing us to echo it back to the room)
|
||||||
|
# discordSendDelay: 750
|
||||||
|
|
||||||
|
matrix_appservice_discord_configuration_extension: "{{ matrix_appservice_discord_configuration_extension_yaml|from_yaml if matrix_appservice_discord_configuration_extension_yaml|from_yaml else {} }}"
|
||||||
|
|
||||||
|
matrix_appservice_discord_configuration: "{{ matrix_appservice_discord_configuration_yaml|from_yaml|combine(matrix_appservice_discord_configuration_extension, recursive=True) }}"
|
21
roles/matrix-bridge-appservice-discord/tasks/main.yml
Normal file
21
roles/matrix-bridge-appservice-discord/tasks/main.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||||
|
when: "run_setup and matrix_appservice_discord_enabled"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-appservice-discord
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||||
|
when: "run_setup and matrix_appservice_discord_enabled"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-appservice-discord
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||||
|
when: "run_setup and not matrix_appservice_discord_enabled"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-appservice-discord
|
|
@ -1,17 +1,24 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
|
# 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
|
||||||
|
fail:
|
||||||
|
msg: >-
|
||||||
|
The matrix-bridge-appservice-discord role needs to execute before the matrix-synapse role.
|
||||||
|
when: "matrix_synapse_role_executed|default(False)"
|
||||||
|
|
||||||
- name: Ensure Appservice Discord image is pulled
|
- name: Ensure Appservice Discord image is pulled
|
||||||
docker_image:
|
docker_image:
|
||||||
name: "{{ matrix_appservice_discord_docker_image }}"
|
name: "{{ matrix_appservice_discord_docker_image }}"
|
||||||
when: "matrix_appservice_discord_enabled"
|
|
||||||
|
|
||||||
- name: Ensure Appservice Discord configuration path exists
|
- name: Ensure Appservice Discord base directory exists
|
||||||
file:
|
file:
|
||||||
path: "{{ matrix_appservice_discord_base_path }}"
|
path: "{{ matrix_appservice_discord_base_path }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0750
|
mode: 0750
|
||||||
owner: "{{ matrix_user_username }}"
|
owner: "{{ matrix_user_username }}"
|
||||||
group: "{{ matrix_user_username }}"
|
group: "{{ matrix_user_username }}"
|
||||||
when: "matrix_appservice_discord_enabled"
|
|
||||||
|
|
||||||
- name: Ensure Matrix Appservice Discord config installed
|
- name: Ensure Matrix Appservice Discord config installed
|
||||||
copy:
|
copy:
|
||||||
|
@ -20,26 +27,23 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: "{{ matrix_user_username }}"
|
owner: "{{ matrix_user_username }}"
|
||||||
group: "{{ matrix_user_username }}"
|
group: "{{ matrix_user_username }}"
|
||||||
when: "matrix_appservice_discord_enabled"
|
|
||||||
|
|
||||||
- name: Ensure matrix-appservice-discord.service installed
|
- name: Ensure matrix-appservice-discord.service installed
|
||||||
template:
|
template:
|
||||||
src: "{{ role_path }}/templates/ext/appservice-discord/systemd/matrix-appservice-discord.service.j2"
|
src: "{{ role_path }}/templates/systemd/matrix-appservice-discord.service.j2"
|
||||||
dest: "/etc/systemd/system/matrix-appservice-discord.service"
|
dest: "/etc/systemd/system/matrix-appservice-discord.service"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
register: matrix_appservice_discord_systemd_service_result
|
register: matrix_appservice_discord_systemd_service_result
|
||||||
when: "matrix_appservice_discord_enabled"
|
|
||||||
|
|
||||||
- name: Ensure systemd reloaded after matrix-appservice-discord.service installation
|
- name: Ensure systemd reloaded after matrix-appservice-discord.service installation
|
||||||
service:
|
service:
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
when: "matrix_appservice_discord_enabled and matrix_appservice_discord_systemd_service_result.changed"
|
when: "matrix_appservice_discord_systemd_service_result.changed"
|
||||||
|
|
||||||
- name: Check if a matrix-appservice-discord registration file exists
|
- name: Check if a matrix-appservice-discord registration file exists
|
||||||
stat:
|
stat:
|
||||||
path: "{{ matrix_appservice_discord_base_path }}/discord-registration.yaml"
|
path: "{{ matrix_appservice_discord_base_path }}/discord-registration.yaml"
|
||||||
register: appservice_discord_registration_file
|
register: appservice_discord_registration_file
|
||||||
when: "matrix_appservice_discord_enabled"
|
|
||||||
|
|
||||||
- name: Generate matrix-appservice-discord discord-registration.yaml if it doesn't exist
|
- name: Generate matrix-appservice-discord discord-registration.yaml if it doesn't exist
|
||||||
shell: >-
|
shell: >-
|
||||||
|
@ -54,17 +58,15 @@
|
||||||
-c /data/config.yaml
|
-c /data/config.yaml
|
||||||
-f /data/discord-registration.yaml
|
-f /data/discord-registration.yaml
|
||||||
-l discord_bot
|
-l discord_bot
|
||||||
when: "matrix_appservice_discord_enabled and not appservice_discord_registration_file.stat.exists"
|
when: "not appservice_discord_registration_file.stat.exists"
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_synapse_app_service_config_file_appservice_discord: '{{ matrix_appservice_discord_base_path }}/discord-registration.yml'
|
matrix_synapse_app_service_config_file_appservice_discord: '{{ matrix_appservice_discord_base_path }}/discord-registration.yml'
|
||||||
when: "matrix_appservice_discord_enabled"
|
|
||||||
|
|
||||||
- name: Check if a matrix-appservice-discord invite_link file exists
|
- name: Check if a matrix-appservice-discord invite_link file exists
|
||||||
stat:
|
stat:
|
||||||
path: "{{ matrix_appservice_discord_base_path }}/invite_link"
|
path: "{{ matrix_appservice_discord_base_path }}/invite_link"
|
||||||
register: appservice_discord_link_generated
|
register: appservice_discord_link_generated
|
||||||
when: "matrix_appservice_discord_enabled"
|
|
||||||
|
|
||||||
- name: Generate your discord invite link
|
- name: Generate your discord invite link
|
||||||
shell: >-
|
shell: >-
|
||||||
|
@ -75,28 +77,17 @@
|
||||||
-w /data
|
-w /data
|
||||||
{{ matrix_appservice_discord_docker_image }}
|
{{ matrix_appservice_discord_docker_image }}
|
||||||
/bin/sh -c "node .././build/tools/addbot.js > invite_link"
|
/bin/sh -c "node .././build/tools/addbot.js > invite_link"
|
||||||
when: "matrix_appservice_discord_enabled and not appservice_discord_link_generated.stat.exists"
|
when: "not appservice_discord_link_generated.stat.exists"
|
||||||
|
|
||||||
|
# If the matrix-synapse role is not used, these variables may not exist.
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_synapse_container_additional_volumes: >
|
matrix_synapse_container_additional_volumes: >
|
||||||
{{ matrix_synapse_container_additional_volumes }}
|
{{ matrix_synapse_container_additional_volumes|default([]) }}
|
||||||
+
|
+
|
||||||
{{ [{'src': '{{ matrix_appservice_discord_base_path }}/discord-registration.yaml', 'dst': '{{ matrix_synapse_app_service_config_file_appservice_discord }}', 'options': 'ro'}] }}
|
{{ [{'src': '{{ matrix_appservice_discord_base_path }}/discord-registration.yaml', 'dst': '{{ matrix_synapse_app_service_config_file_appservice_discord }}', 'options': 'ro'}] }}
|
||||||
when: "matrix_appservice_discord_enabled"
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
matrix_synapse_app_service_config_files: >
|
matrix_synapse_app_service_config_files: >
|
||||||
{{ matrix_synapse_app_service_config_files }}
|
{{ matrix_synapse_app_service_config_files|default([]) }}
|
||||||
+
|
+
|
||||||
{{ ["{{ matrix_synapse_app_service_config_file_appservice_discord }}"] | to_nice_json }}
|
{{ ["{{ matrix_synapse_app_service_config_file_appservice_discord }}"] | to_nice_json }}
|
||||||
when: "matrix_appservice_discord_enabled"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Tasks related to getting rid of matrix-appservice-discord (if it was previously enabled)
|
|
||||||
#
|
|
||||||
|
|
||||||
- name: Ensure matrix-appservice-discord.service doesn't exist
|
|
||||||
file:
|
|
||||||
path: "/etc/systemd/system/matrix-appservice-discord.service"
|
|
||||||
state: absent
|
|
||||||
when: "not matrix_appservice_discord_enabled"
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Ensure matrix-appservice-discord.service doesn't exist
|
||||||
|
file:
|
||||||
|
path: "/etc/systemd/system/matrix-appservice-discord.service"
|
||||||
|
state: absent
|
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Fail if required settings not defined
|
||||||
|
fail:
|
||||||
|
msg: >-
|
||||||
|
You need to define a required configuration setting (`{{ item }}`).
|
||||||
|
when: "vars[item] == ''"
|
||||||
|
with_items:
|
||||||
|
- "matrix_appservice_discord_client_id"
|
||||||
|
- "matrix_appservice_discord_bot_token"
|
|
@ -1,10 +1,13 @@
|
||||||
#jinja2: lstrip_blocks: "True"
|
#jinja2: lstrip_blocks: "True"
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Matrix Appservice Discord server
|
Description=Matrix Appservice Discord server
|
||||||
After=docker.service
|
{% for service in matrix_appservice_discord_systemd_required_services_list %}
|
||||||
Requires=docker.service
|
Requires={{ service }}
|
||||||
Requires=matrix-synapse.service
|
After={{ service }}
|
||||||
After=matrix-synapse.service
|
{% endfor %}
|
||||||
|
{% for service in matrix_appservice_discord_systemd_wanted_services_list %}
|
||||||
|
Wants={{ service }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
@ -20,6 +23,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-appservice-discord \
|
||||||
-p 127.0.0.1:9005:9005 \
|
-p 127.0.0.1:9005:9005 \
|
||||||
{% endif %}
|
{% endif %}
|
||||||
-v {{ matrix_appservice_discord_base_path }}:/data \
|
-v {{ matrix_appservice_discord_base_path }}:/data \
|
||||||
|
{% for arg in matrix_appservice_discord_container_extra_arguments %}
|
||||||
|
{{ arg }} \
|
||||||
|
{% endfor %}
|
||||||
{{ matrix_appservice_discord_docker_image }}
|
{{ matrix_appservice_discord_docker_image }}
|
||||||
|
|
||||||
ExecStop=-/usr/bin/docker kill matrix-appservice-discord
|
ExecStop=-/usr/bin/docker kill matrix-appservice-discord
|
436
roles/matrix-bridge-appservice-irc/defaults/main.yml
Normal file
436
roles/matrix-bridge-appservice-irc/defaults/main.yml
Normal file
|
@ -0,0 +1,436 @@
|
||||||
|
# Matrix Appservice IRC is a Matrix <-> IRC bridge
|
||||||
|
# See: https://github.com/matrix-org/matrix-appservice-irc
|
||||||
|
|
||||||
|
matrix_appservice_irc_enabled: true
|
||||||
|
|
||||||
|
matrix_appservice_irc_docker_image: "tedomum/matrix-appservice-irc:latest"
|
||||||
|
|
||||||
|
matrix_appservice_irc_base_path: "{{ matrix_base_data_path }}/appservice-irc"
|
||||||
|
|
||||||
|
# Controls whether the Appservice IRC container exposes the Client/Server API port (tcp/9999).
|
||||||
|
matrix_appservice_irc_container_expose_client_server_api_port: false
|
||||||
|
|
||||||
|
# A list of extra arguments to pass to the container
|
||||||
|
matrix_appservice_irc_container_extra_arguments: []
|
||||||
|
|
||||||
|
# List of systemd services that matrix-appservice-irc.service depends on.
|
||||||
|
matrix_appservice_irc_systemd_required_services_list: ['docker.service']
|
||||||
|
|
||||||
|
# List of systemd services that matrix-appservice-irc.service wants
|
||||||
|
matrix_appservice_irc_systemd_wanted_services_list: []
|
||||||
|
|
||||||
|
matrix_appservice_irc_configuration_yaml: |
|
||||||
|
#jinja2: lstrip_blocks: True
|
||||||
|
homeserver:
|
||||||
|
url: "https://{{ matrix_server_fqn_matrix }}"
|
||||||
|
domain: "{{ matrix_domain }}"
|
||||||
|
enablePresence: true
|
||||||
|
|
||||||
|
matrix_appservice_irc_configuration_extension_yaml: |
|
||||||
|
# Your custom YAML configuration for Appservice IRC servers goes here.
|
||||||
|
# This configuration extends the default starting configuration (`matrix_appservice_irc_configuration_yaml`).
|
||||||
|
#
|
||||||
|
# You can override individual variables from the default configuration, or introduce new ones.
|
||||||
|
#
|
||||||
|
# If you need something more special, you can take full control by
|
||||||
|
# completely redefining `matrix_appservice_irc_configuration_yaml`.
|
||||||
|
#
|
||||||
|
# Example configuration extension follows:
|
||||||
|
#
|
||||||
|
# ircService:
|
||||||
|
# databaseUri: "nedb:///data" # does not typically need modification
|
||||||
|
# passwordEncryptionKeyPath: "/data/passkey.pem" # does not typically need modification
|
||||||
|
# matrixHandler:
|
||||||
|
# eventCacheSize: 4096
|
||||||
|
# servers:
|
||||||
|
# # The address of the server to connect to.
|
||||||
|
# irc.example.com:
|
||||||
|
# # A human-readable short name. This is used to label IRC status rooms
|
||||||
|
# # where matrix users control their connections.
|
||||||
|
# # E.g. 'ExampleNet IRC Bridge status'.
|
||||||
|
# # It is also used in the Third Party Lookup API as the instance `desc`
|
||||||
|
# # property, where each server is an instance.
|
||||||
|
# name: "ExampleNet"
|
||||||
|
#
|
||||||
|
# additionalAddresses: [ "irc2.example.com" ]
|
||||||
|
# #
|
||||||
|
# # [DEPRECATED] Use `name`, above, instead.
|
||||||
|
# # A human-readable description string
|
||||||
|
# # description: "Example.com IRC network"
|
||||||
|
#
|
||||||
|
# # An ID for uniquely identifying this server amongst other servers being bridged.
|
||||||
|
# # networkId: "example"
|
||||||
|
#
|
||||||
|
# # URL to an icon used as the network icon whenever this network appear in
|
||||||
|
# # a network list. (Like in the riot room directory, for instance.)
|
||||||
|
# # icon: https://example.com/images/hash.png
|
||||||
|
#
|
||||||
|
# # The port to connect to. Optional.
|
||||||
|
# port: 6697
|
||||||
|
# # Whether to use SSL or not. Default: false.
|
||||||
|
# ssl: true
|
||||||
|
# # Whether or not IRC server is using a self-signed cert or not providing CA Chain
|
||||||
|
# sslselfsign: false
|
||||||
|
# # Should the connection attempt to identify via SASL (if a server or user password is given)
|
||||||
|
# # If false, this will use PASS instead. If SASL fails, we do not fallback to PASS.
|
||||||
|
# sasl: false
|
||||||
|
# # Whether to allow expired certs when connecting to the IRC server.
|
||||||
|
# # Usually this should be off. Default: false.
|
||||||
|
# allowExpiredCerts: false
|
||||||
|
# # A specific CA to trust instead of the default CAs. Optional.
|
||||||
|
# #ca: |
|
||||||
|
# # -----BEGIN CERTIFICATE-----
|
||||||
|
# # ...
|
||||||
|
# # -----END CERTIFICATE-----
|
||||||
|
#
|
||||||
|
# #
|
||||||
|
# # The connection password to send for all clients as a PASS (or SASL, if enabled above) command. Optional.
|
||||||
|
# # password: 'pa$$w0rd'
|
||||||
|
# #
|
||||||
|
# # Whether or not to send connection/error notices to real Matrix users. Default: true.
|
||||||
|
# sendConnectionMessages: true
|
||||||
|
#
|
||||||
|
# quitDebounce:
|
||||||
|
# # Whether parts due to net-splits are debounced for delayMs, to allow
|
||||||
|
# # time for the netsplit to resolve itself. A netsplit is detected as being
|
||||||
|
# # a QUIT rate higher than quitsPerSecond. Default: false.
|
||||||
|
# enabled: false
|
||||||
|
# # The maximum number of quits per second acceptable above which a netsplit is
|
||||||
|
# # considered ongoing. Default: 5.
|
||||||
|
# quitsPerSecond: 5
|
||||||
|
# # The time window in which to wait before bridging a QUIT to Matrix that occurred during
|
||||||
|
# # a netsplit. Debouncing is jittered randomly between delayMinMs and delayMaxMs so that the HS
|
||||||
|
# # is not sent many requests to leave rooms all at once if a netsplit occurs and many
|
||||||
|
# # people to not rejoin.
|
||||||
|
# # If the user with the same IRC nick as the one who sent the quit rejoins a channel
|
||||||
|
# # they are considered back online and the quit is not bridged, so long as the rejoin
|
||||||
|
# # occurs before the randomly-jittered timeout is not reached.
|
||||||
|
# # Default: 3600000, = 1h
|
||||||
|
# delayMinMs: 3600000 # 1h
|
||||||
|
# # Default: 7200000, = 2h
|
||||||
|
# delayMaxMs: 7200000 # 2h
|
||||||
|
#
|
||||||
|
# # A map for conversion of IRC user modes to Matrix power levels. This enables bridging
|
||||||
|
# # of IRC ops to Matrix power levels only, it does not enable the reverse. If a user has
|
||||||
|
# # been given multiple modes, the one that maps to the highest power level will be used.
|
||||||
|
# modePowerMap:
|
||||||
|
# o: 50
|
||||||
|
#
|
||||||
|
# botConfig:
|
||||||
|
# # Enable the presence of the bot in IRC channels. The bot serves as the entity
|
||||||
|
# # which maps from IRC -> Matrix. You can disable the bot entirely which
|
||||||
|
# # means IRC -> Matrix chat will be shared by active "M-Nick" connections
|
||||||
|
# # in the room. If there are no users in the room (or if there are users
|
||||||
|
# # but their connections are not on IRC) then nothing will be bridged to
|
||||||
|
# # Matrix. If you're concerned about the bot being treated as a "logger"
|
||||||
|
# # entity, then you may want to disable the bot. If you want IRC->Matrix
|
||||||
|
# # but don't want to have TCP connections to IRC unless a Matrix user speaks
|
||||||
|
# # (because your client connection limit is low), then you may want to keep
|
||||||
|
# # the bot enabled. Default: true.
|
||||||
|
# # NB: If the bot is disabled, you SHOULD have matrix-to-IRC syncing turned
|
||||||
|
# # on, else there will be no users and no bot in a channel (meaning no
|
||||||
|
# # messages to Matrix!) until a Matrix user speaks which makes a client
|
||||||
|
# # join the target IRC channel.
|
||||||
|
# # NBB: The bridge bot IRC client will still join the target IRC network so
|
||||||
|
# # it can service bridge-specific queries from the IRC-side e.g. so
|
||||||
|
# # real IRC clients have a way to change their Matrix display name.
|
||||||
|
# # See https://github.com/matrix-org/matrix-appservice-irc/issues/55
|
||||||
|
# enabled: true
|
||||||
|
# # The nickname to give the AS bot.
|
||||||
|
# nick: "MatrixBot"
|
||||||
|
# # The password to give to NickServ or IRC Server for this nick. Optional.
|
||||||
|
# # password: "helloworld"
|
||||||
|
# #
|
||||||
|
# # Join channels even if there are no Matrix users on the other side of
|
||||||
|
# # the bridge. Set to false to prevent the bot from joining channels which have no
|
||||||
|
# # real matrix users in them, even if there is a mapping for the channel.
|
||||||
|
# # Default: true
|
||||||
|
# joinChannelsIfNoUsers: true
|
||||||
|
#
|
||||||
|
# # Configuration for PMs / private 1:1 communications between users.
|
||||||
|
# privateMessages:
|
||||||
|
# # Enable the ability for PMs to be sent to/from IRC/Matrix.
|
||||||
|
# # Default: true.
|
||||||
|
# enabled: true
|
||||||
|
# # Prevent Matrix users from sending PMs to the following IRC nicks.
|
||||||
|
# # Optional. Default: [].
|
||||||
|
# # exclude: ["Alice", "Bob"] # NOT YET IMPLEMENTED
|
||||||
|
#
|
||||||
|
# # Should created Matrix PM rooms be federated? If false, only users on the
|
||||||
|
# # HS attached to this AS will be able to interact with this room.
|
||||||
|
# # Optional. Default: true.
|
||||||
|
# federate: true
|
||||||
|
#
|
||||||
|
# # Configuration for mappings not explicitly listed in the 'mappings'
|
||||||
|
# # section.
|
||||||
|
# dynamicChannels:
|
||||||
|
# # Enable the ability for Matrix users to join *any* channel on this IRC
|
||||||
|
# # network.
|
||||||
|
# # Default: false.
|
||||||
|
# enabled: true
|
||||||
|
# # Should the AS create a room alias for the new Matrix room? The form of
|
||||||
|
# # the alias can be modified via 'aliasTemplate'. Default: true.
|
||||||
|
# createAlias: true
|
||||||
|
# # Should the AS publish the new Matrix room to the public room list so
|
||||||
|
# # anyone can see it? Default: true.
|
||||||
|
# published: true
|
||||||
|
# # What should the join_rule be for the new Matrix room? If 'public',
|
||||||
|
# # anyone can join the room. If 'invite', only users with an invite can
|
||||||
|
# # join the room. Note that if an IRC channel has +k or +i set on it,
|
||||||
|
# # join_rules will be set to 'invite' until these modes are removed.
|
||||||
|
# # Default: "public".
|
||||||
|
# joinRule: public
|
||||||
|
# # This will set the m.room.related_groups state event in newly created rooms
|
||||||
|
# # with the given groupId. This means flares will show up on IRC users in those rooms.
|
||||||
|
# # This should be set to the same thing as namespaces.users.group_id in irc_registration.
|
||||||
|
# # This does not alter existing rooms.
|
||||||
|
# # Leaving this option empty will not set the event.
|
||||||
|
# groupId: +myircnetwork:localhost
|
||||||
|
# # Should created Matrix rooms be federated? If false, only users on the
|
||||||
|
# # HS attached to this AS will be able to interact with this room.
|
||||||
|
# # Default: true.
|
||||||
|
# federate: true
|
||||||
|
# # The room alias template to apply when creating new aliases. This only
|
||||||
|
# # applies if createAlias is 'true'. The following variables are exposed:
|
||||||
|
# # $SERVER => The IRC server address (e.g. "irc.example.com")
|
||||||
|
# # $CHANNEL => The IRC channel (e.g. "#python")
|
||||||
|
# # This MUST have $CHANNEL somewhere in it.
|
||||||
|
# # Default: '#irc_$SERVER_$CHANNEL'
|
||||||
|
# aliasTemplate: "#irc_$CHANNEL"
|
||||||
|
# # A list of user IDs which the AS bot will send invites to in response
|
||||||
|
# # to a !join. Only applies if joinRule is 'invite'. Default: []
|
||||||
|
# # whitelist:
|
||||||
|
# # - "@foo:example.com"
|
||||||
|
# # - "@bar:example.com"
|
||||||
|
# #
|
||||||
|
# # Prevent the given list of channels from being mapped under any
|
||||||
|
# # circumstances.
|
||||||
|
# # exclude: ["#foo", "#bar"]
|
||||||
|
#
|
||||||
|
# # Configuration for controlling how Matrix and IRC membership lists are
|
||||||
|
# # synced.
|
||||||
|
# membershipLists:
|
||||||
|
# # Enable the syncing of membership lists between IRC and Matrix. This
|
||||||
|
# # can have a significant effect on performance on startup as the lists are
|
||||||
|
# # synced. This must be enabled for anything else in this section to take
|
||||||
|
# # effect. Default: false.
|
||||||
|
# enabled: false
|
||||||
|
#
|
||||||
|
# # Syncing membership lists at startup can result in hundreds of members to
|
||||||
|
# # process all at once. This timer drip feeds membership entries at the
|
||||||
|
# # specified rate. Default: 10000. (10s)
|
||||||
|
# floodDelayMs: 10000
|
||||||
|
#
|
||||||
|
# global:
|
||||||
|
# ircToMatrix:
|
||||||
|
# # Get a snapshot of all real IRC users on a channel (via NAMES) and
|
||||||
|
# # join their virtual matrix clients to the room.
|
||||||
|
# initial: false
|
||||||
|
# # Make virtual matrix clients join and leave rooms as their real IRC
|
||||||
|
# # counterparts join/part channels. Default: false.
|
||||||
|
# incremental: false
|
||||||
|
#
|
||||||
|
# matrixToIrc:
|
||||||
|
# # Get a snapshot of all real Matrix users in the room and join all of
|
||||||
|
# # them to the mapped IRC channel on startup. Default: false.
|
||||||
|
# initial: false
|
||||||
|
# # Make virtual IRC clients join and leave channels as their real Matrix
|
||||||
|
# # counterparts join/leave rooms. Make sure your 'maxClients' value is
|
||||||
|
# # high enough! Default: false.
|
||||||
|
# incremental: false
|
||||||
|
#
|
||||||
|
# # Apply specific rules to Matrix rooms. Only matrix-to-IRC takes effect.
|
||||||
|
# rooms:
|
||||||
|
# - room: "!fuasirouddJoxtwfge:localhost"
|
||||||
|
# matrixToIrc:
|
||||||
|
# initial: false
|
||||||
|
# incremental: false
|
||||||
|
#
|
||||||
|
# # Apply specific rules to IRC channels. Only IRC-to-matrix takes effect.
|
||||||
|
# channels:
|
||||||
|
# - channel: "#foo"
|
||||||
|
# ircToMatrix:
|
||||||
|
# initial: false
|
||||||
|
# incremental: false
|
||||||
|
#
|
||||||
|
# mappings:
|
||||||
|
# # 1:many mappings from IRC channels to room IDs on this IRC server.
|
||||||
|
# # The matrix room must already exist. Your matrix client should expose
|
||||||
|
# # the room ID in a "settings" page for the room.
|
||||||
|
# "#thepub": ["!kieouiJuedJoxtVdaG:localhost"]
|
||||||
|
#
|
||||||
|
# # Configuration for virtual matrix users. The following variables are
|
||||||
|
# # exposed:
|
||||||
|
# # $NICK => The IRC nick
|
||||||
|
# # $SERVER => The IRC server address (e.g. "irc.example.com")
|
||||||
|
# matrixClients:
|
||||||
|
# # The user ID template to use when creating virtual matrix users. This
|
||||||
|
# # MUST have $NICK somewhere in it.
|
||||||
|
# # Optional. Default: "@$SERVER_$NICK".
|
||||||
|
# # Example: "@irc.example.com_Alice:example.com"
|
||||||
|
# userTemplate: "@irc_$NICK"
|
||||||
|
# # The display name to use for created matrix clients. This should have
|
||||||
|
# # $NICK somewhere in it if it is specified. Can also use $SERVER to
|
||||||
|
# # insert the IRC domain.
|
||||||
|
# # Optional. Default: "$NICK (IRC)". Example: "Alice (IRC)"
|
||||||
|
# displayName: "$NICK (IRC)"
|
||||||
|
# # Number of tries a client can attempt to join a room before the request
|
||||||
|
# # is discarded. You can also use -1 to never retry or 0 to never give up.
|
||||||
|
# # Optional. Default: -1
|
||||||
|
# joinAttempts: -1
|
||||||
|
#
|
||||||
|
# # Configuration for virtual IRC users. The following variables are exposed:
|
||||||
|
# # $LOCALPART => The user ID localpart ("alice" in @alice:localhost)
|
||||||
|
# # $USERID => The user ID
|
||||||
|
# # $DISPLAY => The display name of this user, with excluded characters
|
||||||
|
# # (e.g. space) removed. If the user has no display name, this
|
||||||
|
# # falls back to $LOCALPART.
|
||||||
|
# ircClients:
|
||||||
|
# # The template to apply to every IRC client nick. This MUST have either
|
||||||
|
# # $DISPLAY or $USERID or $LOCALPART somewhere in it.
|
||||||
|
# # Optional. Default: "M-$DISPLAY". Example: "M-Alice".
|
||||||
|
# nickTemplate: "$DISPLAY[m]"
|
||||||
|
# # True to allow virtual IRC clients to change their nick on this server
|
||||||
|
# # by issuing !nick <server> <nick> commands to the IRC AS bot.
|
||||||
|
# # This is completely freeform: it will NOT follow the nickTemplate.
|
||||||
|
# allowNickChanges: true
|
||||||
|
# # The max number of IRC clients that will connect. If the limit is
|
||||||
|
# # reached, the client that spoke the longest time ago will be
|
||||||
|
# # disconnected and replaced.
|
||||||
|
# # Optional. Default: 30.
|
||||||
|
# maxClients: 30
|
||||||
|
# # IPv6 configuration.
|
||||||
|
# ipv6:
|
||||||
|
# # Optional. Set to true to force IPv6 for outgoing connections.
|
||||||
|
# only: false
|
||||||
|
# # Optional. The IPv6 prefix to use for generating unique addresses for each
|
||||||
|
# # connected user. If not specified, all users will connect from the same
|
||||||
|
# # (default) address. This may require additional OS-specific work to allow
|
||||||
|
# # for the node process to bind to multiple different source addresses
|
||||||
|
# # e.g IP_FREEBIND on Linux, which requires an LD_PRELOAD with the library
|
||||||
|
# # https://github.com/matrix-org/freebindfree as Node does not expose setsockopt.
|
||||||
|
# # prefix: "2001:0db8:85a3::" # modify appropriately
|
||||||
|
# #
|
||||||
|
# # The maximum amount of time in seconds that the client can exist
|
||||||
|
# # without sending another message before being disconnected. Use 0 to
|
||||||
|
# # not apply an idle timeout. This value is ignored if this IRC server is
|
||||||
|
# # mirroring matrix membership lists to IRC. Default: 172800 (48 hours)
|
||||||
|
# idleTimeout: 10800
|
||||||
|
# # The number of millseconds to wait between consecutive reconnections if a
|
||||||
|
# # client gets disconnected. Setting to 0 will cause the scheduling to be
|
||||||
|
# # disabled, i.e. it will be scheduled immediately (with jitter.
|
||||||
|
# # Otherwise, the scheduling interval will be used such that one client
|
||||||
|
# # reconnect for this server will be handled every reconnectIntervalMs ms using
|
||||||
|
# # a FIFO queue.
|
||||||
|
# # Default: 5000 (5 seconds)
|
||||||
|
# reconnectIntervalMs: 5000
|
||||||
|
# # The number of concurrent reconnects if a user has been disconnected unexpectedly
|
||||||
|
# # (e.g. a netsplit). You should set this to a reasonably high number so that
|
||||||
|
# # bridges are not waiting an eternity to reconnect all its clients if
|
||||||
|
# # we see a massive number of disconnect. This is unrelated to the reconnectIntervalMs
|
||||||
|
# # setting above which is for connecting on restart of the bridge. Set to 0 to
|
||||||
|
# # immediately try to reconnect all users.
|
||||||
|
# # Default: 50
|
||||||
|
# concurrentReconnectLimit: 50
|
||||||
|
# # The number of lines to allow being sent by the IRC client that has received
|
||||||
|
# # a large block of text to send from matrix. If the number of lines that would
|
||||||
|
# # be sent is > lineLimit, the text will instead be uploaded to matrix and the
|
||||||
|
# # resulting URI is treated as a file. As such, a link will be sent to the IRC
|
||||||
|
# # side instead of potentially spamming IRC and getting the IRC client kicked.
|
||||||
|
# # Default: 3.
|
||||||
|
# lineLimit: 3
|
||||||
|
# # A list of user modes to set on every IRC client. For example, "RiG" would set
|
||||||
|
# # +R, +i and +G on every IRC connection when they have successfully connected.
|
||||||
|
# # User modes vary wildly depending on the IRC network you're connecting to,
|
||||||
|
# # so check before setting this value. Some modes may not work as intended
|
||||||
|
# # through the bridge e.g. caller ID as there is no way to /ACCEPT.
|
||||||
|
# # Default: "" (no user modes)
|
||||||
|
# # userModes: "R"
|
||||||
|
#
|
||||||
|
# # Configuration for an ident server. If you are running a public bridge it is
|
||||||
|
# # advised you setup an ident server so IRC mods can ban specific matrix users
|
||||||
|
# # rather than the application service itself.
|
||||||
|
# ident:
|
||||||
|
# # True to listen for Ident requests and respond with the
|
||||||
|
# # matrix user's user_id (converted to ASCII, respecting RFC 1413).
|
||||||
|
# # Default: false.
|
||||||
|
# enabled: false
|
||||||
|
# # The port to listen on for incoming ident requests.
|
||||||
|
# # Ports below 1024 require root to listen on, and you may not want this to
|
||||||
|
# # run as root. Instead, you can get something like an Apache to yank up
|
||||||
|
# # incoming requests to 113 to a high numbered port. Set the port to listen
|
||||||
|
# # on instead of 113 here.
|
||||||
|
# # Default: 113.
|
||||||
|
# port: 1113
|
||||||
|
# # The address to listen on for incoming ident requests.
|
||||||
|
# # Default: 0.0.0.0
|
||||||
|
# address: "::"
|
||||||
|
#
|
||||||
|
# # Configuration for logging. Optional. Default: console debug level logging
|
||||||
|
# # only.
|
||||||
|
# logging:
|
||||||
|
# # Level to log on console/logfile. One of error|warn|info|debug
|
||||||
|
# level: "debug"
|
||||||
|
# # The file location to log to. This is relative to the project directory.
|
||||||
|
# logfile: "debug.log"
|
||||||
|
# # The file location to log errors to. This is relative to the project
|
||||||
|
# # directory.
|
||||||
|
# errfile: "errors.log"
|
||||||
|
# # Whether to log to the console or not.
|
||||||
|
# toConsole: true
|
||||||
|
# # The max number of files to keep. Files will be overwritten eventually due
|
||||||
|
# # to rotations.
|
||||||
|
# maxFiles: 5
|
||||||
|
#
|
||||||
|
# # Optional. Enable Prometheus metrics. If this is enabled, you MUST install `prom-client`:
|
||||||
|
# # $ npm install prom-client@6.3.0
|
||||||
|
# # Metrics will then be available via GET /metrics on the bridge listening port (-p).
|
||||||
|
# metrics:
|
||||||
|
# # Whether to actually enable the metric endpoint. Default: false
|
||||||
|
# enabled: true
|
||||||
|
# # When collecting remote user active times, which "buckets" should be used. Defaults are given below.
|
||||||
|
# # The bucket name is formed of a duration and a period. (h=hours,d=days,w=weeks).
|
||||||
|
# remoteUserAgeBuckets:
|
||||||
|
# - "1h"
|
||||||
|
# - "1d"
|
||||||
|
# - "1w"
|
||||||
|
#
|
||||||
|
# # Configuration options for the debug HTTP API. To access this API, you must
|
||||||
|
# # append ?access_token=$APPSERVICE_TOKEN (from the registration file) to the requests.
|
||||||
|
# #
|
||||||
|
# # The debug API exposes the following endpoints:
|
||||||
|
# #
|
||||||
|
# # GET /irc/$domain/user/$user_id => Return internal state for the IRC client for this user ID.
|
||||||
|
# #
|
||||||
|
# # POST /irc/$domain/user/$user_id => Issue a raw IRC command down this connection.
|
||||||
|
# # Format: new line delimited commands as per IRC protocol.
|
||||||
|
# #
|
||||||
|
# debugApi:
|
||||||
|
# # True to enable the HTTP API endpoint. Default: false.
|
||||||
|
# enabled: false
|
||||||
|
# # The port to host the HTTP API.
|
||||||
|
# port: 11100
|
||||||
|
#
|
||||||
|
# # Configuration for the provisioning API.
|
||||||
|
# #
|
||||||
|
# # GET /_matrix/provision/link
|
||||||
|
# # GET /_matrix/provision/unlink
|
||||||
|
# # GET /_matrix/provision/listlinks
|
||||||
|
# #
|
||||||
|
# provisioning:
|
||||||
|
# # True to enable the provisioning HTTP endpoint. Default: false.
|
||||||
|
# enabled: false
|
||||||
|
# # The number of seconds to wait before giving up on getting a response from
|
||||||
|
# # an IRC channel operator. If the channel operator does not respond within the
|
||||||
|
# # allotted time period, the provisioning request will fail.
|
||||||
|
# # Default: 300 seconds (5 mins)
|
||||||
|
# requestTimeoutSeconds: 300
|
||||||
|
#
|
||||||
|
# # WARNING: The bridge needs to send plaintext passwords to the IRC server, it cannot
|
||||||
|
# # send a password hash. As a result, passwords (NOT hashes) are stored encrypted in
|
||||||
|
# # the database.
|
||||||
|
# #
|
||||||
|
|
||||||
|
matrix_appservice_irc_configuration_extension: "{{ matrix_appservice_irc_configuration_extension_yaml|from_yaml if matrix_appservice_irc_configuration_extension_yaml|from_yaml else {} }}"
|
||||||
|
|
||||||
|
matrix_appservice_irc_configuration: "{{ matrix_appservice_irc_configuration_yaml|from_yaml|combine(matrix_appservice_irc_configuration_extension, recursive=True) }}"
|
21
roles/matrix-bridge-appservice-irc/tasks/main.yml
Normal file
21
roles/matrix-bridge-appservice-irc/tasks/main.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||||
|
when: "run_setup and matrix_appservice_irc_enabled"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-appservice-irc
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||||
|
when: "run_setup and matrix_appservice_irc_enabled"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-appservice-irc
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||||
|
when: "run_setup and not matrix_appservice_irc_enabled"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-appservice-irc
|
|
@ -1,17 +1,24 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
|
# 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
|
||||||
|
fail:
|
||||||
|
msg: >-
|
||||||
|
The matrix-bridge-appservice-irc role needs to execute before the matrix-synapse role.
|
||||||
|
when: "matrix_synapse_role_executed|default(False)"
|
||||||
|
|
||||||
- name: Ensure Appservice IRC image is pulled
|
- name: Ensure Appservice IRC image is pulled
|
||||||
docker_image:
|
docker_image:
|
||||||
name: "{{ matrix_appservice_irc_docker_image }}"
|
name: "{{ matrix_appservice_irc_docker_image }}"
|
||||||
when: "matrix_appservice_irc_enabled"
|
|
||||||
|
|
||||||
- name: Ensure Appservice IRC configuration path exists
|
- name: Ensure Appservice IRC base directory exists
|
||||||
file:
|
file:
|
||||||
path: "{{ matrix_appservice_irc_base_path }}"
|
path: "{{ matrix_appservice_irc_base_path }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0750
|
mode: 0750
|
||||||
owner: "{{ matrix_user_username }}"
|
owner: "{{ matrix_user_username }}"
|
||||||
group: "{{ matrix_user_username }}"
|
group: "{{ matrix_user_username }}"
|
||||||
when: "matrix_appservice_irc_enabled"
|
|
||||||
|
|
||||||
- name: Ensure Matrix Appservice IRC config installed
|
- name: Ensure Matrix Appservice IRC config installed
|
||||||
copy:
|
copy:
|
||||||
|
@ -20,36 +27,32 @@
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: "{{ matrix_user_username }}"
|
owner: "{{ matrix_user_username }}"
|
||||||
group: "{{ matrix_user_username }}"
|
group: "{{ matrix_user_username }}"
|
||||||
when: "matrix_appservice_irc_enabled"
|
|
||||||
|
|
||||||
- name: Check if matrix-appservice-irc passkey exists
|
- name: Check if matrix-appservice-irc passkey exists
|
||||||
stat:
|
stat:
|
||||||
path: "{{ matrix_appservice_irc_base_path }}/passkey.pem"
|
path: "{{ matrix_appservice_irc_base_path }}/passkey.pem"
|
||||||
register: irc_passkey_file
|
register: irc_passkey_file
|
||||||
when: "matrix_appservice_irc_enabled"
|
|
||||||
|
|
||||||
- name: Generate matrix-appservice-irc passkey if it doesn't exist
|
- name: Generate matrix-appservice-irc passkey if it doesn't exist
|
||||||
shell: /usr/bin/openssl genpkey -out {{ matrix_appservice_irc_base_path }}/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048
|
shell: /usr/bin/openssl genpkey -out {{ matrix_appservice_irc_base_path }}/passkey.pem -outform PEM -algorithm RSA -pkeyopt rsa_keygen_bits:2048
|
||||||
when: "matrix_appservice_irc_enabled and not irc_passkey_file.stat.exists"
|
when: "not irc_passkey_file.stat.exists"
|
||||||
|
|
||||||
- name: Ensure matrix-appservice-irc.service installed
|
- name: Ensure matrix-appservice-irc.service installed
|
||||||
template:
|
template:
|
||||||
src: "{{ role_path }}/templates/ext/appservice-irc/systemd/matrix-appservice-irc.service.j2"
|
src: "{{ role_path }}/templates/systemd/matrix-appservice-irc.service.j2"
|
||||||
dest: "/etc/systemd/system/matrix-appservice-irc.service"
|
dest: "/etc/systemd/system/matrix-appservice-irc.service"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
register: matrix_appservice_irc_systemd_service_result
|
register: matrix_appservice_irc_systemd_service_result
|
||||||
when: "matrix_appservice_irc_enabled"
|
|
||||||
|
|
||||||
- name: Ensure systemd reloaded after matrix-appservice-irc.service installation
|
- name: Ensure systemd reloaded after matrix-appservice-irc.service installation
|
||||||
service:
|
service:
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
when: "matrix_appservice_irc_enabled and matrix_appservice_irc_systemd_service_result.changed"
|
when: "matrix_appservice_irc_systemd_service_result.changed"
|
||||||
|
|
||||||
- name: Check if a matrix-appservice-irc registration file exists
|
- name: Check if a matrix-appservice-irc registration file exists
|
||||||
stat:
|
stat:
|
||||||
path: "{{ matrix_appservice_irc_base_path }}/registration.yaml"
|
path: "{{ matrix_appservice_irc_base_path }}/registration.yaml"
|
||||||
register: appservice_irc_registration_file
|
register: appservice_irc_registration_file
|
||||||
when: "matrix_appservice_irc_enabled"
|
|
||||||
|
|
||||||
- name: Generate matrix-appservice-irc registration.yaml if it doesn't exist
|
- name: Generate matrix-appservice-irc registration.yaml if it doesn't exist
|
||||||
shell: >-
|
shell: >-
|
||||||
|
@ -64,25 +67,22 @@
|
||||||
-u "http://matrix-appservice-irc:9999"
|
-u "http://matrix-appservice-irc:9999"
|
||||||
-c /data/config.yaml
|
-c /data/config.yaml
|
||||||
-l irc_bot
|
-l irc_bot
|
||||||
when: "matrix_appservice_irc_enabled and not appservice_irc_registration_file.stat.exists"
|
when: "not appservice_irc_registration_file.stat.exists"
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_synapse_app_service_config_file_appservice_irc: '/app-registration/appservice-irc.yml'
|
matrix_synapse_app_service_config_file_appservice_irc: '/app-registration/appservice-irc.yml'
|
||||||
when: "matrix_appservice_irc_enabled"
|
|
||||||
|
|
||||||
|
# If the matrix-synapse role is not used, these variables may not exist.
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_synapse_container_additional_volumes: >
|
matrix_synapse_container_additional_volumes: >
|
||||||
{{ matrix_synapse_container_additional_volumes }}
|
{{ matrix_synapse_container_additional_volumes|default([]) }}
|
||||||
+
|
+
|
||||||
{{ [{'src': '{{ matrix_appservice_irc_base_path }}/registration.yaml', 'dst': '{{ matrix_synapse_app_service_config_file_appservice_irc }}', 'options': 'ro'}] }}
|
{{ [{'src': '{{ matrix_appservice_irc_base_path }}/registration.yaml', 'dst': '{{ matrix_synapse_app_service_config_file_appservice_irc }}', 'options': 'ro'}] }}
|
||||||
when: "matrix_appservice_irc_enabled"
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
matrix_synapse_app_service_config_files: >
|
matrix_synapse_app_service_config_files: >
|
||||||
{{ matrix_synapse_app_service_config_files }}
|
{{ matrix_synapse_app_service_config_files|default([]) }}
|
||||||
+
|
+
|
||||||
{{ ["{{ matrix_synapse_app_service_config_file_appservice_irc }}"] | to_nice_json }}
|
{{ ["{{ matrix_synapse_app_service_config_file_appservice_irc }}"] | to_nice_json }}
|
||||||
when: "matrix_appservice_irc_enabled"
|
|
||||||
|
|
||||||
- name: Ensure IRC configuration directory permissions are correct
|
- name: Ensure IRC configuration directory permissions are correct
|
||||||
file:
|
file:
|
||||||
|
@ -91,14 +91,3 @@
|
||||||
owner: "{{ matrix_user_username }}"
|
owner: "{{ matrix_user_username }}"
|
||||||
group: "{{ matrix_user_username }}"
|
group: "{{ matrix_user_username }}"
|
||||||
recurse: true
|
recurse: true
|
||||||
when: "matrix_appservice_irc_enabled"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Tasks related to getting rid of matrix-appservice-irc (if it was previously enabled)
|
|
||||||
#
|
|
||||||
|
|
||||||
- name: Ensure matrix-appservice-irc.service doesn't exist
|
|
||||||
file:
|
|
||||||
path: "/etc/systemd/system/matrix-appservice-irc.service"
|
|
||||||
state: absent
|
|
||||||
when: "not matrix_appservice_irc_enabled"
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Ensure matrix-appservice-irc.service doesn't exist
|
||||||
|
file:
|
||||||
|
path: "/etc/systemd/system/matrix-appservice-irc.service"
|
||||||
|
state: absent
|
16
roles/matrix-bridge-appservice-irc/tasks/validate_config.yml
Normal file
16
roles/matrix-bridge-appservice-irc/tasks/validate_config.yml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
# Our base configuration (`matrix_appservice_irc_configuration_yaml`) is not enough to
|
||||||
|
# let the playbook run without errors.
|
||||||
|
#
|
||||||
|
# Unless the final configuration (`matrix_appservice_irc_configuration`) contains an `ircService` definition,
|
||||||
|
# we'd fail generating the registration.yaml file with a non-helpful error.
|
||||||
|
#
|
||||||
|
# This is a safety check to ensure we fail earlier and in a nicer way.
|
||||||
|
- name: Fail if no additional configuration provided
|
||||||
|
fail:
|
||||||
|
msg: >-
|
||||||
|
Your Appservice IRC configuration is incomplete (lacking an `ircService` key).
|
||||||
|
You need to define additional configuration in `matrix_appservice_irc_configuration_extension_yaml` or to override `matrix_appservice_irc_configuration`.
|
||||||
|
when: "matrix_appservice_irc_configuration.ircService|default(none) is none"
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
#jinja2: lstrip_blocks: "True"
|
#jinja2: lstrip_blocks: "True"
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Matrix Appservice IRC server
|
Description=Matrix Appservice IRC server
|
||||||
After=docker.service
|
{% for service in matrix_appservice_irc_systemd_required_services_list %}
|
||||||
Requires=docker.service
|
Requires={{ service }}
|
||||||
Requires=matrix-synapse.service
|
After={{ service }}
|
||||||
After=matrix-synapse.service
|
{% endfor %}
|
||||||
|
{% for service in matrix_appservice_irc_systemd_wanted_services_list %}
|
||||||
|
Wants={{ service }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
@ -20,6 +23,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-appservice-irc \
|
||||||
-p 127.0.0.1:9999:9999 \
|
-p 127.0.0.1:9999:9999 \
|
||||||
{% endif %}
|
{% endif %}
|
||||||
-v {{ matrix_appservice_irc_base_path }}:/data:z \
|
-v {{ matrix_appservice_irc_base_path }}:/data:z \
|
||||||
|
{% for arg in matrix_appservice_irc_container_extra_arguments %}
|
||||||
|
{{ arg }} \
|
||||||
|
{% endfor %}
|
||||||
{{ matrix_appservice_irc_docker_image }} \
|
{{ matrix_appservice_irc_docker_image }} \
|
||||||
-c /data/config.yaml -f /data/registration.yaml -p 9999
|
-c /data/config.yaml -f /data/registration.yaml -p 9999
|
||||||
|
|
25
roles/matrix-bridge-mautrix-facebook/defaults/main.yml
Normal file
25
roles/matrix-bridge-mautrix-facebook/defaults/main.yml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# mautrix-facebook is a Matrix <-> Facebook bridge
|
||||||
|
# See: https://github.com/tulir/mautrix-facebook
|
||||||
|
|
||||||
|
matrix_mautrix_facebook_enabled: true
|
||||||
|
|
||||||
|
matrix_mautrix_facebook_docker_image: "tulir/mautrix-facebook:latest"
|
||||||
|
|
||||||
|
matrix_mautrix_facebook_base_path: "{{ matrix_base_data_path }}/mautrix-facebook"
|
||||||
|
|
||||||
|
# Get your own API keys at https://developers.facebook.com/docs/apis-and-sdks/
|
||||||
|
matrix_mautrix_facebook_api_id: ''
|
||||||
|
matrix_mautrix_facebook_api_hash: ''
|
||||||
|
|
||||||
|
matrix_mautrix_facebook_homeserver_address: 'https://{{ matrix_server_fqn_matrix }}'
|
||||||
|
matrix_mautrix_facebook_homeserver_domain: '{{ matrix_domain }}'
|
||||||
|
matrix_mautrix_facebook_appservice_address: 'http://matrix-mautrix-facebook:8080'
|
||||||
|
|
||||||
|
# A list of extra arguments to pass to the container
|
||||||
|
matrix_mautrix_facebook_container_extra_arguments: []
|
||||||
|
|
||||||
|
# List of systemd services that matrix-mautrix-facebook.service depends on.
|
||||||
|
matrix_mautrix_facebook_systemd_required_services_list: ['docker.service']
|
||||||
|
|
||||||
|
# List of systemd services that matrix-mautrix-facebook.service wants
|
||||||
|
matrix_mautrix_facebook_systemd_wanted_services_list: []
|
|
@ -1,3 +1,3 @@
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-facebook'] }}"
|
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-facebook'] }}"
|
||||||
when: matrix_mautrix_facebook_enabled
|
when: "matrix_mautrix_facebook_enabled"
|
21
roles/matrix-bridge-mautrix-facebook/tasks/main.yml
Normal file
21
roles/matrix-bridge-mautrix-facebook/tasks/main.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||||
|
when: "run_setup and matrix_mautrix_facebook_enabled"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-mautrix-facebook
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||||
|
when: "run_setup and matrix_mautrix_facebook_enabled"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-mautrix-facebook
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||||
|
when: "run_setup and not matrix_mautrix_facebook_enabled"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-mautrix-facebook
|
|
@ -1,63 +1,55 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
|
# 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
|
||||||
|
fail:
|
||||||
|
msg: >-
|
||||||
|
The matrix-bridge-mautrix-facebook role needs to execute before the matrix-synapse role.
|
||||||
|
when: "matrix_synapse_role_executed|default(False)"
|
||||||
|
|
||||||
- name: Ensure Mautrix Facebook image is pulled
|
- name: Ensure Mautrix Facebook image is pulled
|
||||||
docker_image:
|
docker_image:
|
||||||
name: "{{ matrix_mautrix_facebook_docker_image }}"
|
name: "{{ matrix_mautrix_facebook_docker_image }}"
|
||||||
when: "matrix_mautrix_facebook_enabled"
|
|
||||||
|
|
||||||
- name: Ensure Mautrix Facebook configuration path exists
|
- name: Ensure Mautrix Facebook base directory exists
|
||||||
file:
|
file:
|
||||||
path: "{{ matrix_mautrix_facebook_base_path }}"
|
path: "{{ matrix_mautrix_facebook_base_path }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0750
|
mode: 0750
|
||||||
owner: "{{ matrix_user_username }}"
|
owner: "{{ matrix_user_username }}"
|
||||||
group: "{{ matrix_user_username }}"
|
group: "{{ matrix_user_username }}"
|
||||||
when: "matrix_mautrix_facebook_enabled"
|
|
||||||
|
|
||||||
- name: Check if a mautrix-facebook configuration file exists
|
- name: Check if a mautrix-facebook configuration file exists
|
||||||
stat:
|
stat:
|
||||||
path: "{{ matrix_mautrix_facebook_base_path }}/config.yaml"
|
path: "{{ matrix_mautrix_facebook_base_path }}/config.yaml"
|
||||||
register: mautrix_facebook_config_file_stat
|
register: mautrix_facebook_config_file_stat
|
||||||
when: "matrix_mautrix_facebook_enabled"
|
|
||||||
|
|
||||||
- name: Ensure Matrix Mautrix facebook config installed
|
- name: Ensure Matrix Mautrix facebook config installed
|
||||||
template:
|
template:
|
||||||
src: "{{ role_path }}/templates/ext/mautrix-facebook/config.yaml.j2"
|
src: "{{ role_path }}/templates/config.yaml.j2"
|
||||||
dest: "{{ matrix_mautrix_facebook_base_path }}/config.yaml"
|
dest: "{{ matrix_mautrix_facebook_base_path }}/config.yaml"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: "{{ matrix_user_username }}"
|
owner: "{{ matrix_user_username }}"
|
||||||
group: "{{ matrix_user_username }}"
|
group: "{{ matrix_user_username }}"
|
||||||
when: "matrix_mautrix_facebook_enabled and not mautrix_facebook_config_file_stat.stat.exists"
|
when: "not mautrix_facebook_config_file_stat.stat.exists"
|
||||||
|
|
||||||
- name: (Migration) Fix up old configuration
|
|
||||||
lineinfile:
|
|
||||||
path: "{{ matrix_mautrix_facebook_base_path }}/config.yaml"
|
|
||||||
regexp: "{{ item.regexp }}"
|
|
||||||
line: "{{ item.line }}"
|
|
||||||
backrefs: yes
|
|
||||||
with_items:
|
|
||||||
- {'regexp': '^(\s+)filename: \./mautrix-facebook.log', 'line': '\1filename: /data/mautrix-facebook.log'}
|
|
||||||
- {'regexp': '^(\s+)database:', 'line': '\1database: sqlite:////data/mautrix-facebook.db'}
|
|
||||||
when: "matrix_mautrix_facebook_enabled and mautrix_facebook_config_file_stat.stat.exists"
|
|
||||||
|
|
||||||
- name: Ensure matrix-mautrix-facebook.service installed
|
- name: Ensure matrix-mautrix-facebook.service installed
|
||||||
template:
|
template:
|
||||||
src: "{{ role_path }}/templates/ext/mautrix-facebook/systemd/matrix-mautrix-facebook.service.j2"
|
src: "{{ role_path }}/templates/systemd/matrix-mautrix-facebook.service.j2"
|
||||||
dest: "/etc/systemd/system/matrix-mautrix-facebook.service"
|
dest: "/etc/systemd/system/matrix-mautrix-facebook.service"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
register: matrix_mautrix_facebook_systemd_service_result
|
register: matrix_mautrix_facebook_systemd_service_result
|
||||||
when: "matrix_mautrix_facebook_enabled"
|
|
||||||
|
|
||||||
- name: Ensure systemd reloaded after matrix-mautrix-facebook.service installation
|
- name: Ensure systemd reloaded after matrix-mautrix-facebook.service installation
|
||||||
service:
|
service:
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
when: "matrix_mautrix_facebook_enabled and matrix_mautrix_facebook_systemd_service_result.changed"
|
when: "matrix_mautrix_facebook_systemd_service_result.changed"
|
||||||
|
|
||||||
- name: Check if a mautrix-facebook registration file exists
|
- name: Check if a mautrix-facebook registration file exists
|
||||||
stat:
|
stat:
|
||||||
path: "{{ matrix_mautrix_facebook_base_path }}/registration.yaml"
|
path: "{{ matrix_mautrix_facebook_base_path }}/registration.yaml"
|
||||||
register: mautrix_facebook_registration_file_stat
|
register: mautrix_facebook_registration_file_stat
|
||||||
when: "matrix_mautrix_facebook_enabled"
|
|
||||||
|
|
||||||
- name: Generate matrix-mautrix-facebook registration.yaml if it doesn't exist
|
- name: Generate matrix-mautrix-facebook registration.yaml if it doesn't exist
|
||||||
shell:
|
shell:
|
||||||
|
@ -70,32 +62,19 @@
|
||||||
-v {{ matrix_mautrix_facebook_base_path }}:/data:z
|
-v {{ matrix_mautrix_facebook_base_path }}:/data:z
|
||||||
{{ matrix_mautrix_facebook_docker_image }}
|
{{ matrix_mautrix_facebook_docker_image }}
|
||||||
python3 -m mautrix_facebook -g -c /data/config.yaml -r /data/registration.yaml
|
python3 -m mautrix_facebook -g -c /data/config.yaml -r /data/registration.yaml
|
||||||
when: "matrix_mautrix_facebook_enabled and not mautrix_facebook_registration_file_stat.stat.exists"
|
when: "not mautrix_facebook_registration_file_stat.stat.exists"
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_synapse_app_service_config_file_mautrix_facebook: '/app-registration/mautrix-facebook.yml'
|
matrix_synapse_app_service_config_file_mautrix_facebook: '/app-registration/mautrix-facebook.yml'
|
||||||
when: "matrix_mautrix_facebook_enabled"
|
|
||||||
|
|
||||||
|
# If the matrix-synapse role is not used, these variables may not exist.
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_synapse_container_additional_volumes: >
|
matrix_synapse_container_additional_volumes: >
|
||||||
{{ matrix_synapse_container_additional_volumes }}
|
{{ matrix_synapse_container_additional_volumes|default([]) }}
|
||||||
+
|
+
|
||||||
{{ [{'src': '{{ matrix_mautrix_facebook_base_path }}/registration.yaml', 'dst': '{{ matrix_synapse_app_service_config_file_mautrix_facebook }}', 'options': 'ro'}] }}
|
{{ [{'src': '{{ matrix_mautrix_facebook_base_path }}/registration.yaml', 'dst': '{{ matrix_synapse_app_service_config_file_mautrix_facebook }}', 'options': 'ro'}] }}
|
||||||
when: "matrix_mautrix_facebook_enabled"
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
matrix_synapse_app_service_config_files: >
|
matrix_synapse_app_service_config_files: >
|
||||||
{{ matrix_synapse_app_service_config_files }}
|
{{ matrix_synapse_app_service_config_files|default([]) }}
|
||||||
+
|
+
|
||||||
{{ ["{{ matrix_synapse_app_service_config_file_mautrix_facebook }}"] | to_nice_json }}
|
{{ ["{{ matrix_synapse_app_service_config_file_mautrix_facebook }}"] | to_nice_json }}
|
||||||
when: "matrix_mautrix_facebook_enabled"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Tasks related to getting rid of matrix-mautrix-facebook (if it was previously enabled)
|
|
||||||
#
|
|
||||||
|
|
||||||
- name: Ensure matrix-mautrix-facebook.service doesn't exist
|
|
||||||
file:
|
|
||||||
path: "/etc/systemd/system/matrix-mautrix-facebook.service"
|
|
||||||
state: absent
|
|
||||||
when: "not matrix_mautrix_facebook_enabled"
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Ensure matrix-mautrix-facebook.service doesn't exist
|
||||||
|
file:
|
||||||
|
path: "/etc/systemd/system/matrix-mautrix-facebook.service"
|
||||||
|
state: absent
|
|
@ -0,0 +1,10 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Fail if required settings not defined
|
||||||
|
fail:
|
||||||
|
msg: >-
|
||||||
|
You need to define a required configuration setting (`{{ item }}`).
|
||||||
|
when: "vars[item] == ''"
|
||||||
|
with_items:
|
||||||
|
- "matrix_mautrix_facebook_api_id"
|
||||||
|
- "matrix_mautrix_facebook_api_hash"
|
|
@ -2,9 +2,9 @@
|
||||||
# Homeserver details
|
# Homeserver details
|
||||||
homeserver:
|
homeserver:
|
||||||
# The address that this appservice can use to connect to the homeserver.
|
# The address that this appservice can use to connect to the homeserver.
|
||||||
address: https://{{ matrix_server_fqn_matrix }}
|
address: {{ matrix_mautrix_facebook_homeserver_address }}
|
||||||
# The domain of the homeserver (for MXIDs, etc).
|
# The domain of the homeserver (for MXIDs, etc).
|
||||||
domain: {{ matrix_domain }}
|
domain: {{ matrix_mautrix_facebook_homeserver_domain }}
|
||||||
# Whether or not to verify the SSL certificate of the homeserver.
|
# Whether or not to verify the SSL certificate of the homeserver.
|
||||||
# Only applies if address starts with https://
|
# Only applies if address starts with https://
|
||||||
verify_ssl: true
|
verify_ssl: true
|
||||||
|
@ -13,7 +13,7 @@ homeserver:
|
||||||
# Changing these values requires regeneration of the registration.
|
# Changing these values requires regeneration of the registration.
|
||||||
appservice:
|
appservice:
|
||||||
# The address that the homeserver can use to connect to this appservice.
|
# The address that the homeserver can use to connect to this appservice.
|
||||||
address: http://matrix-mautrix-facebook:8080
|
address: {{ matrix_mautrix_facebook_appservice_address }}
|
||||||
|
|
||||||
# The hostname and port where this appservice should listen.
|
# The hostname and port where this appservice should listen.
|
||||||
hostname: 0.0.0.0
|
hostname: 0.0.0.0
|
||||||
|
@ -73,7 +73,7 @@ bridge:
|
||||||
# domain - All users on that homeserver
|
# domain - All users on that homeserver
|
||||||
# mxid - Specific user
|
# mxid - Specific user
|
||||||
permissions:
|
permissions:
|
||||||
'{{ matrix_domain }}': user
|
'{{ matrix_mautrix_facebook_homeserver_domain }}': user
|
||||||
|
|
||||||
# Python logging configuration.
|
# Python logging configuration.
|
||||||
#
|
#
|
|
@ -1,10 +1,13 @@
|
||||||
#jinja2: lstrip_blocks: "True"
|
#jinja2: lstrip_blocks: "True"
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Matrix Mautrix Facebook server
|
Description=Matrix Mautrix Facebook server
|
||||||
After=docker.service
|
{% for service in matrix_mautrix_facebook_systemd_required_services_list %}
|
||||||
Requires=docker.service
|
Requires={{ service }}
|
||||||
Requires=matrix-synapse.service
|
After={{ service }}
|
||||||
After=matrix-synapse.service
|
{% endfor %}
|
||||||
|
{% for service in matrix_mautrix_facebook_systemd_wanted_services_list %}
|
||||||
|
Wants={{ service }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
@ -24,6 +27,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-mautrix-facebook \
|
||||||
--cap-drop=ALL \
|
--cap-drop=ALL \
|
||||||
--network={{ matrix_docker_network }} \
|
--network={{ matrix_docker_network }} \
|
||||||
-v {{ matrix_mautrix_facebook_base_path }}:/data:z \
|
-v {{ matrix_mautrix_facebook_base_path }}:/data:z \
|
||||||
|
{% for arg in matrix_mautrix_facebook_container_extra_arguments %}
|
||||||
|
{{ arg }} \
|
||||||
|
{% endfor %}
|
||||||
{{ matrix_mautrix_facebook_docker_image }} \
|
{{ matrix_mautrix_facebook_docker_image }} \
|
||||||
python3 -m mautrix_facebook -c /data/config.yaml
|
python3 -m mautrix_facebook -c /data/config.yaml
|
||||||
|
|
34
roles/matrix-bridge-mautrix-telegram/defaults/main.yml
Normal file
34
roles/matrix-bridge-mautrix-telegram/defaults/main.yml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
# mautrix-telegram is a Matrix <-> Telegram bridge
|
||||||
|
# See: https://github.com/tulir/mautrix-telegram
|
||||||
|
|
||||||
|
matrix_mautrix_telegram_enabled: true
|
||||||
|
|
||||||
|
matrix_mautrix_telegram_docker_image: "tulir/mautrix-telegram:v0.5.1"
|
||||||
|
|
||||||
|
matrix_mautrix_telegram_base_path: "{{ matrix_base_data_path }}/mautrix-telegram"
|
||||||
|
|
||||||
|
# Get your own API keys at https://my.telegram.org/apps
|
||||||
|
matrix_mautrix_telegram_api_id: ''
|
||||||
|
matrix_mautrix_telegram_api_hash: ''
|
||||||
|
|
||||||
|
# Mautrix telegram public endpoint to log in to telegram
|
||||||
|
# Use an uuid so it's not easily discoverable.
|
||||||
|
# Example: /741a0483-ba17-4682-9900-30bd7269f1cc
|
||||||
|
matrix_mautrix_telegram_public_endpoint: ''
|
||||||
|
|
||||||
|
matrix_mautrix_telegram_homeserver_address: 'https://{{ matrix_server_fqn_matrix }}'
|
||||||
|
matrix_mautrix_telegram_homeserver_domain: '{{ matrix_domain }}'
|
||||||
|
matrix_mautrix_telegram_appservice_address: 'http://matrix-mautrix-telegram:8080'
|
||||||
|
matrix_mautrix_telegram_appservice_public_external: 'https://{{ matrix_server_fqn_matrix }}{{ matrix_mautrix_telegram_public_endpoint }}'
|
||||||
|
|
||||||
|
# Set this to a port number to expose on the host when not using matrix-nginx-proxy
|
||||||
|
matrix_mautrix_telegram_container_exposed_port_number: ~
|
||||||
|
|
||||||
|
# A list of extra arguments to pass to the container
|
||||||
|
matrix_mautrix_telegram_container_extra_arguments: []
|
||||||
|
|
||||||
|
# List of systemd services that matrix-mautrix-telegram.service depends on.
|
||||||
|
matrix_mautrix_telegram_systemd_required_services_list: ['docker.service']
|
||||||
|
|
||||||
|
# List of systemd services that matrix-mautrix-telegram.service wants
|
||||||
|
matrix_mautrix_telegram_systemd_wanted_services_list: []
|
|
@ -1,3 +1,3 @@
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-telegram'] }}"
|
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-telegram'] }}"
|
||||||
when: matrix_mautrix_telegram_enabled
|
when: "matrix_mautrix_telegram_enabled"
|
21
roles/matrix-bridge-mautrix-telegram/tasks/main.yml
Normal file
21
roles/matrix-bridge-mautrix-telegram/tasks/main.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||||
|
when: "run_setup and matrix_mautrix_telegram_enabled"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-mautrix-telegram
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||||
|
when: "run_setup and matrix_mautrix_telegram_enabled"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-mautrix-telegram
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||||
|
when: "run_setup and not matrix_mautrix_telegram_enabled"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-mautrix-telegram
|
|
@ -1,33 +1,38 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
|
# 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
|
||||||
|
fail:
|
||||||
|
msg: >-
|
||||||
|
The matrix-bridge-mautrix-telegram role needs to execute before the matrix-synapse role.
|
||||||
|
when: "matrix_synapse_role_executed|default(False)"
|
||||||
|
|
||||||
- name: Ensure Mautrix Telegram image is pulled
|
- name: Ensure Mautrix Telegram image is pulled
|
||||||
docker_image:
|
docker_image:
|
||||||
name: "{{ matrix_mautrix_telegram_docker_image }}"
|
name: "{{ matrix_mautrix_telegram_docker_image }}"
|
||||||
when: "matrix_mautrix_telegram_enabled"
|
|
||||||
|
|
||||||
- name: Ensure Mautrix Telegram configuration path exists
|
- name: Ensure Mautrix Telegram base directory exists
|
||||||
file:
|
file:
|
||||||
path: "{{ matrix_mautrix_telegram_base_path }}"
|
path: "{{ matrix_mautrix_telegram_base_path }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0750
|
mode: 0750
|
||||||
owner: "{{ matrix_user_username }}"
|
owner: "{{ matrix_user_username }}"
|
||||||
group: "{{ matrix_user_username }}"
|
group: "{{ matrix_user_username }}"
|
||||||
when: "matrix_mautrix_telegram_enabled"
|
|
||||||
|
|
||||||
- name: Check if a mautrix-telegram configuration file exists
|
- name: Check if a mautrix-telegram configuration file exists
|
||||||
stat:
|
stat:
|
||||||
path: "{{ matrix_mautrix_telegram_base_path }}/config.yaml"
|
path: "{{ matrix_mautrix_telegram_base_path }}/config.yaml"
|
||||||
register: mautrix_telegram_config_file_stat
|
register: mautrix_telegram_config_file_stat
|
||||||
when: "matrix_mautrix_telegram_enabled"
|
|
||||||
|
|
||||||
- name: Ensure Matrix Mautrix telegram config installed
|
- name: Ensure Matrix Mautrix telegram config installed
|
||||||
template:
|
template:
|
||||||
src: "{{ role_path }}/templates/ext/mautrix-telegram/config.yaml.j2"
|
src: "{{ role_path }}/templates/config.yaml.j2"
|
||||||
dest: "{{ matrix_mautrix_telegram_base_path }}/config.yaml"
|
dest: "{{ matrix_mautrix_telegram_base_path }}/config.yaml"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: "{{ matrix_user_username }}"
|
owner: "{{ matrix_user_username }}"
|
||||||
group: "{{ matrix_user_username }}"
|
group: "{{ matrix_user_username }}"
|
||||||
when: "matrix_mautrix_telegram_enabled and not mautrix_telegram_config_file_stat.stat.exists"
|
when: "not mautrix_telegram_config_file_stat.stat.exists"
|
||||||
|
|
||||||
- name: (Migration) Fix up old configuration
|
- name: (Migration) Fix up old configuration
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
@ -38,26 +43,24 @@
|
||||||
with_items:
|
with_items:
|
||||||
- {'regexp': '^(\s+)filename: \./mautrix-telegram.log', 'line': '\1filename: /data/mautrix-telegram.log'}
|
- {'regexp': '^(\s+)filename: \./mautrix-telegram.log', 'line': '\1filename: /data/mautrix-telegram.log'}
|
||||||
- {'regexp': '^(\s+)database:', 'line': '\1database: sqlite:////data/mautrix-telegram.db'}
|
- {'regexp': '^(\s+)database:', 'line': '\1database: sqlite:////data/mautrix-telegram.db'}
|
||||||
when: "matrix_mautrix_telegram_enabled and mautrix_telegram_config_file_stat.stat.exists"
|
when: "mautrix_telegram_config_file_stat.stat.exists"
|
||||||
|
|
||||||
- name: Ensure matrix-mautrix-telegram.service installed
|
- name: Ensure matrix-mautrix-telegram.service installed
|
||||||
template:
|
template:
|
||||||
src: "{{ role_path }}/templates/ext/mautrix-telegram/systemd/matrix-mautrix-telegram.service.j2"
|
src: "{{ role_path }}/templates/systemd/matrix-mautrix-telegram.service.j2"
|
||||||
dest: "/etc/systemd/system/matrix-mautrix-telegram.service"
|
dest: "/etc/systemd/system/matrix-mautrix-telegram.service"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
register: matrix_mautrix_telegram_systemd_service_result
|
register: matrix_mautrix_telegram_systemd_service_result
|
||||||
when: "matrix_mautrix_telegram_enabled"
|
|
||||||
|
|
||||||
- name: Ensure systemd reloaded after matrix-mautrix-telegram.service installation
|
- name: Ensure systemd reloaded after matrix-mautrix-telegram.service installation
|
||||||
service:
|
service:
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
when: "matrix_mautrix_telegram_enabled and matrix_mautrix_telegram_systemd_service_result.changed"
|
when: "matrix_mautrix_telegram_systemd_service_result.changed"
|
||||||
|
|
||||||
- name: Check if a mautrix-telegram registration file exists
|
- name: Check if a mautrix-telegram registration file exists
|
||||||
stat:
|
stat:
|
||||||
path: "{{ matrix_mautrix_telegram_base_path }}/registration.yaml"
|
path: "{{ matrix_mautrix_telegram_base_path }}/registration.yaml"
|
||||||
register: mautrix_telegram_registration_file_stat
|
register: mautrix_telegram_registration_file_stat
|
||||||
when: "matrix_mautrix_telegram_enabled"
|
|
||||||
|
|
||||||
- name: Generate matrix-mautrix-telegram registration.yaml if it doesn't exist
|
- name: Generate matrix-mautrix-telegram registration.yaml if it doesn't exist
|
||||||
shell:
|
shell:
|
||||||
|
@ -70,25 +73,22 @@
|
||||||
-v {{ matrix_mautrix_telegram_base_path }}:/data:z
|
-v {{ matrix_mautrix_telegram_base_path }}:/data:z
|
||||||
{{ matrix_mautrix_telegram_docker_image }}
|
{{ matrix_mautrix_telegram_docker_image }}
|
||||||
python3 -m mautrix_telegram -g -c /data/config.yaml -r /data/registration.yaml
|
python3 -m mautrix_telegram -g -c /data/config.yaml -r /data/registration.yaml
|
||||||
when: "matrix_mautrix_telegram_enabled and not mautrix_telegram_registration_file_stat.stat.exists"
|
when: "not mautrix_telegram_registration_file_stat.stat.exists"
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_synapse_app_service_config_file_mautrix_telegram: '/app-registration/mautrix-telegram.yml'
|
matrix_synapse_app_service_config_file_mautrix_telegram: '/app-registration/mautrix-telegram.yml'
|
||||||
when: "matrix_mautrix_telegram_enabled"
|
|
||||||
|
|
||||||
|
# If the matrix-synapse role is not used, these variables may not exist.
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_synapse_container_additional_volumes: >
|
matrix_synapse_container_additional_volumes: >
|
||||||
{{ matrix_synapse_container_additional_volumes }}
|
{{ matrix_synapse_container_additional_volumes|default([]) }}
|
||||||
+
|
+
|
||||||
{{ [{'src': '{{ matrix_mautrix_telegram_base_path }}/registration.yaml', 'dst': '{{ matrix_synapse_app_service_config_file_mautrix_telegram }}', 'options': 'ro'}] }}
|
{{ [{'src': '{{ matrix_mautrix_telegram_base_path }}/registration.yaml', 'dst': '{{ matrix_synapse_app_service_config_file_mautrix_telegram }}', 'options': 'ro'}] }}
|
||||||
when: "matrix_mautrix_telegram_enabled"
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
matrix_synapse_app_service_config_files: >
|
matrix_synapse_app_service_config_files: >
|
||||||
{{ matrix_synapse_app_service_config_files }}
|
{{ matrix_synapse_app_service_config_files|default([]) }}
|
||||||
+
|
+
|
||||||
{{ ["{{ matrix_synapse_app_service_config_file_mautrix_telegram }}"] | to_nice_json }}
|
{{ ["{{ matrix_synapse_app_service_config_file_mautrix_telegram }}"] | to_nice_json }}
|
||||||
when: "matrix_mautrix_telegram_enabled"
|
|
||||||
|
|
||||||
- block:
|
- block:
|
||||||
- name: Fail if matrix-nginx-proxy role already executed
|
- name: Fail if matrix-nginx-proxy role already executed
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
Trying to append Mautrix Telegram's reverse-proxying configuration to matrix-nginx-proxy,
|
Trying to append Mautrix Telegram's reverse-proxying configuration to matrix-nginx-proxy,
|
||||||
but it's pointless since the matrix-nginx-proxy role had already executed.
|
but it's pointless since the matrix-nginx-proxy role had already executed.
|
||||||
To fix this, please change the order of roles in your plabook,
|
To fix this, please change the order of roles in your plabook,
|
||||||
so that the matrix-nginx-proxy role would run after the matrix-synapse role.
|
so that the matrix-nginx-proxy role would run after the matrix-bridge-mautrix-telegram role.
|
||||||
when: "matrix_nginx_proxy_role_executed"
|
when: "matrix_nginx_proxy_role_executed"
|
||||||
|
|
||||||
- name: Generate Mautrix Telegram proxying configuration for matrix-nginx-proxy
|
- name: Generate Mautrix Telegram proxying configuration for matrix-nginx-proxy
|
||||||
|
@ -124,7 +124,7 @@
|
||||||
[matrix_mautrix_telegram_matrix_nginx_proxy_configuration]
|
[matrix_mautrix_telegram_matrix_nginx_proxy_configuration]
|
||||||
}}
|
}}
|
||||||
|
|
||||||
when: "matrix_mautrix_telegram_enabled and matrix_nginx_proxy_enabled|default(False)"
|
when: "matrix_nginx_proxy_enabled|default(False)"
|
||||||
tags:
|
tags:
|
||||||
- always
|
- always
|
||||||
|
|
||||||
|
@ -135,14 +135,4 @@
|
||||||
reverse proxy.
|
reverse proxy.
|
||||||
Please make sure that you're proxying the `{{ matrix_mautrix_telegram_public_endpoint }}`
|
Please make sure that you're proxying the `{{ matrix_mautrix_telegram_public_endpoint }}`
|
||||||
URL endpoint to the matrix-mautrix-telegram container.
|
URL endpoint to the matrix-mautrix-telegram container.
|
||||||
when: "matrix_mautrix_telegram_enabled and matrix_nginx_proxy_enabled is not defined"
|
when: "matrix_nginx_proxy_enabled is not defined"
|
||||||
|
|
||||||
#
|
|
||||||
# Tasks related to getting rid of matrix-mautrix-telegram (if it was previously enabled)
|
|
||||||
#
|
|
||||||
|
|
||||||
- name: Ensure matrix-mautrix-telegram.service doesn't exist
|
|
||||||
file:
|
|
||||||
path: "/etc/systemd/system/matrix-mautrix-telegram.service"
|
|
||||||
state: absent
|
|
||||||
when: "not matrix_mautrix_telegram_enabled"
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Ensure matrix-mautrix-telegram.service doesn't exist
|
||||||
|
file:
|
||||||
|
path: "/etc/systemd/system/matrix-mautrix-telegram.service"
|
||||||
|
state: absent
|
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Fail if required settings not defined
|
||||||
|
fail:
|
||||||
|
msg: >-
|
||||||
|
You need to define a required configuration setting (`{{ item }}`).
|
||||||
|
when: "vars[item] == ''"
|
||||||
|
with_items:
|
||||||
|
- "matrix_mautrix_telegram_api_id"
|
||||||
|
- "matrix_mautrix_telegram_api_hash"
|
||||||
|
- "matrix_mautrix_telegram_public_endpoint"
|
|
@ -2,9 +2,9 @@
|
||||||
# Homeserver details
|
# Homeserver details
|
||||||
homeserver:
|
homeserver:
|
||||||
# The address that this appservice can use to connect to the homeserver.
|
# The address that this appservice can use to connect to the homeserver.
|
||||||
address: https://{{ matrix_server_fqn_matrix }}
|
address: {{ matrix_mautrix_telegram_homeserver_address }}
|
||||||
# The domain of the homeserver (for MXIDs, etc).
|
# The domain of the homeserver (for MXIDs, etc).
|
||||||
domain: {{ matrix_domain }}
|
domain: {{ matrix_mautrix_telegram_homeserver_domain }}
|
||||||
# Whether or not to verify the SSL certificate of the homeserver.
|
# Whether or not to verify the SSL certificate of the homeserver.
|
||||||
# Only applies if address starts with https://
|
# Only applies if address starts with https://
|
||||||
verify_ssl: true
|
verify_ssl: true
|
||||||
|
@ -13,7 +13,7 @@ homeserver:
|
||||||
# Changing these values requires regeneration of the registration.
|
# Changing these values requires regeneration of the registration.
|
||||||
appservice:
|
appservice:
|
||||||
# The address that the homeserver can use to connect to this appservice.
|
# The address that the homeserver can use to connect to this appservice.
|
||||||
address: http://matrix-mautrix-telegram:8080
|
address: {{ matrix_mautrix_telegram_appservice_address }}
|
||||||
|
|
||||||
# The hostname and port where this appservice should listen.
|
# The hostname and port where this appservice should listen.
|
||||||
hostname: 0.0.0.0
|
hostname: 0.0.0.0
|
||||||
|
@ -39,7 +39,7 @@ appservice:
|
||||||
prefix: {{ matrix_mautrix_telegram_public_endpoint }}
|
prefix: {{ matrix_mautrix_telegram_public_endpoint }}
|
||||||
# The base URL where the public-facing endpoints are available. The prefix is not added
|
# The base URL where the public-facing endpoints are available. The prefix is not added
|
||||||
# implicitly.
|
# implicitly.
|
||||||
external: https://{{ matrix_server_fqn_matrix }}{{ matrix_mautrix_telegram_public_endpoint }}
|
external: {{ matrix_mautrix_telegram_appservice_public_external }}
|
||||||
|
|
||||||
# Provisioning API part of the web server for automated portal creation and fetching information.
|
# Provisioning API part of the web server for automated portal creation and fetching information.
|
||||||
# Used by things like Dimension (https://dimension.t2bot.io/).
|
# Used by things like Dimension (https://dimension.t2bot.io/).
|
||||||
|
@ -207,7 +207,7 @@ bridge:
|
||||||
# domain - All users on that homeserver
|
# domain - All users on that homeserver
|
||||||
# mxid - Specific user
|
# mxid - Specific user
|
||||||
permissions:
|
permissions:
|
||||||
'{{ matrix_domain }}': full
|
'{{ matrix_mautrix_telegram_homeserver_domain }}': full
|
||||||
|
|
||||||
# Options related to the message relay Telegram bot.
|
# Options related to the message relay Telegram bot.
|
||||||
relaybot:
|
relaybot:
|
|
@ -1,10 +1,13 @@
|
||||||
#jinja2: lstrip_blocks: "True"
|
#jinja2: lstrip_blocks: "True"
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Matrix Mautrix Telegram server
|
Description=Matrix Mautrix Telegram server
|
||||||
After=docker.service
|
{% for service in matrix_mautrix_telegram_systemd_required_services_list %}
|
||||||
Requires=docker.service
|
Requires={{ service }}
|
||||||
Requires=matrix-synapse.service
|
After={{ service }}
|
||||||
After=matrix-synapse.service
|
{% endfor %}
|
||||||
|
{% for service in matrix_mautrix_telegram_systemd_wanted_services_list %}
|
||||||
|
Wants={{ service }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
@ -27,6 +30,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-mautrix-telegram \
|
||||||
-p 127.0.0.1:{{ matrix_mautrix_telegram_container_exposed_port_number }}:8080 \
|
-p 127.0.0.1:{{ matrix_mautrix_telegram_container_exposed_port_number }}:8080 \
|
||||||
{% endif %}
|
{% endif %}
|
||||||
-v {{ matrix_mautrix_telegram_base_path }}:/data:z \
|
-v {{ matrix_mautrix_telegram_base_path }}:/data:z \
|
||||||
|
{% for arg in matrix_mautrix_telegram_container_extra_arguments %}
|
||||||
|
{{ arg }} \
|
||||||
|
{% endfor %}
|
||||||
{{ matrix_mautrix_telegram_docker_image }} \
|
{{ matrix_mautrix_telegram_docker_image }} \
|
||||||
python3 -m mautrix_telegram -c /data/config.yaml
|
python3 -m mautrix_telegram -c /data/config.yaml
|
||||||
|
|
21
roles/matrix-bridge-mautrix-whatsapp/defaults/main.yml
Normal file
21
roles/matrix-bridge-mautrix-whatsapp/defaults/main.yml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# mautrix-whatsapp is a Matrix <-> Whatsapp bridge
|
||||||
|
# See: https://github.com/tulir/mautrix-whatsapp
|
||||||
|
|
||||||
|
matrix_mautrix_whatsapp_enabled: true
|
||||||
|
|
||||||
|
matrix_mautrix_whatsapp_docker_image: "tulir/mautrix-whatsapp:latest"
|
||||||
|
|
||||||
|
matrix_mautrix_whatsapp_base_path: "{{ matrix_base_data_path }}/mautrix-whatsapp"
|
||||||
|
|
||||||
|
matrix_mautrix_whatsapp_homeserver_address: "https://{{ matrix_server_fqn_matrix }}"
|
||||||
|
matrix_mautrix_whatsapp_homeserver_domain: "{{ matrix_domain }}"
|
||||||
|
matrix_mautrix_whatsapp_appservice_address: "http://matrix-mautrix-whatsapp:8080"
|
||||||
|
|
||||||
|
# A list of extra arguments to pass to the container
|
||||||
|
matrix_mautrix_whatsapp_container_extra_arguments: []
|
||||||
|
|
||||||
|
# List of systemd services that matrix-mautrix-whatsapp.service depends on.
|
||||||
|
matrix_mautrix_whatsapp_systemd_required_services_list: ['docker.service']
|
||||||
|
|
||||||
|
# List of systemd services that matrix-mautrix-whatsapp.service wants
|
||||||
|
matrix_mautrix_whatsapp_systemd_wanted_services_list: []
|
|
@ -1,3 +1,3 @@
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-whatsapp'] }}"
|
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-mautrix-whatsapp'] }}"
|
||||||
when: matrix_mautrix_whatsapp_enabled
|
when: "matrix_mautrix_whatsapp_enabled"
|
15
roles/matrix-bridge-mautrix-whatsapp/tasks/main.yml
Normal file
15
roles/matrix-bridge-mautrix-whatsapp/tasks/main.yml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||||
|
when: "run_setup and matrix_mautrix_whatsapp_enabled"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-mautrix-whatsapp
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||||
|
when: "run_setup and not matrix_mautrix_whatsapp_enabled"
|
||||||
|
tags:
|
||||||
|
- setup-all
|
||||||
|
- setup-mautrix-whatsapp
|
|
@ -1,52 +1,55 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
|
# 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
|
||||||
|
fail:
|
||||||
|
msg: >-
|
||||||
|
The matrix-bridge-mautrix-whatsapp role needs to execute before the matrix-synapse role.
|
||||||
|
when: "matrix_synapse_role_executed|default(False)"
|
||||||
|
|
||||||
- name: Ensure Mautrix Whatsapp image is pulled
|
- name: Ensure Mautrix Whatsapp image is pulled
|
||||||
docker_image:
|
docker_image:
|
||||||
name: "{{ matrix_mautrix_whatsapp_docker_image }}"
|
name: "{{ matrix_mautrix_whatsapp_docker_image }}"
|
||||||
when: "matrix_mautrix_whatsapp_enabled"
|
|
||||||
|
|
||||||
- name: Ensure Mautrix Whatsapp configuration path exists
|
- name: Ensure Mautrix Whatsapp base directory exists
|
||||||
file:
|
file:
|
||||||
path: "{{ matrix_mautrix_whatsapp_base_path }}"
|
path: "{{ matrix_mautrix_whatsapp_base_path }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: 0750
|
mode: 0750
|
||||||
owner: "{{ matrix_user_username }}"
|
owner: "{{ matrix_user_username }}"
|
||||||
group: "{{ matrix_user_username }}"
|
group: "{{ matrix_user_username }}"
|
||||||
when: "matrix_mautrix_whatsapp_enabled"
|
|
||||||
|
|
||||||
- name: Check if a mautrix-whatsapp configuration file exists
|
- name: Check if a mautrix-whatsapp configuration file exists
|
||||||
stat:
|
stat:
|
||||||
path: "{{ matrix_mautrix_whatsapp_base_path }}/config.yaml"
|
path: "{{ matrix_mautrix_whatsapp_base_path }}/config.yaml"
|
||||||
register: mautrix_whatsapp_config_file_stat
|
register: mautrix_whatsapp_config_file_stat
|
||||||
when: "matrix_mautrix_whatsapp_enabled"
|
|
||||||
|
|
||||||
- name: Ensure Matrix Mautrix whatsapp config installed
|
- name: Ensure Matrix Mautrix whatsapp config installed
|
||||||
template:
|
template:
|
||||||
src: "{{ role_path }}/templates/ext/mautrix-whatsapp/config.yaml.j2"
|
src: "{{ role_path }}/templates//config.yaml.j2"
|
||||||
dest: "{{ matrix_mautrix_whatsapp_base_path }}/config.yaml"
|
dest: "{{ matrix_mautrix_whatsapp_base_path }}/config.yaml"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
owner: "{{ matrix_user_username }}"
|
owner: "{{ matrix_user_username }}"
|
||||||
group: "{{ matrix_user_username }}"
|
group: "{{ matrix_user_username }}"
|
||||||
when: "matrix_mautrix_whatsapp_enabled and not mautrix_whatsapp_config_file_stat.stat.exists"
|
when: "not mautrix_whatsapp_config_file_stat.stat.exists"
|
||||||
|
|
||||||
- name: Ensure matrix-mautrix-whatsapp.service installed
|
- name: Ensure matrix-mautrix-whatsapp.service installed
|
||||||
template:
|
template:
|
||||||
src: "{{ role_path }}/templates/ext/mautrix-whatsapp/systemd/matrix-mautrix-whatsapp.service.j2"
|
src: "{{ role_path }}/templates/systemd/matrix-mautrix-whatsapp.service.j2"
|
||||||
dest: "/etc/systemd/system/matrix-mautrix-whatsapp.service"
|
dest: "/etc/systemd/system/matrix-mautrix-whatsapp.service"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
register: matrix_mautrix_whatsapp_systemd_service_result
|
register: matrix_mautrix_whatsapp_systemd_service_result
|
||||||
when: "matrix_mautrix_whatsapp_enabled"
|
|
||||||
|
|
||||||
- name: Ensure systemd reloaded after matrix-mautrix-whatsapp.service installation
|
- name: Ensure systemd reloaded after matrix-mautrix-whatsapp.service installation
|
||||||
service:
|
service:
|
||||||
daemon_reload: yes
|
daemon_reload: yes
|
||||||
when: "matrix_mautrix_whatsapp_enabled and matrix_mautrix_whatsapp_systemd_service_result.changed"
|
when: "matrix_mautrix_whatsapp_systemd_service_result.changed"
|
||||||
|
|
||||||
- name: Check if a mautrix-whatsapp registration file exists
|
- name: Check if a mautrix-whatsapp registration file exists
|
||||||
stat:
|
stat:
|
||||||
path: "{{ matrix_mautrix_whatsapp_base_path }}/registration.yaml"
|
path: "{{ matrix_mautrix_whatsapp_base_path }}/registration.yaml"
|
||||||
register: mautrix_whatsapp_registration_file_stat
|
register: mautrix_whatsapp_registration_file_stat
|
||||||
when: "matrix_mautrix_whatsapp_enabled"
|
|
||||||
|
|
||||||
- name: Generate matrix-mautrix-whatsapp registration.yaml if it doesn't exist
|
- name: Generate matrix-mautrix-whatsapp registration.yaml if it doesn't exist
|
||||||
shell:
|
shell:
|
||||||
|
@ -59,32 +62,19 @@
|
||||||
-v {{ matrix_mautrix_whatsapp_base_path }}:/data:z
|
-v {{ matrix_mautrix_whatsapp_base_path }}:/data:z
|
||||||
{{ matrix_mautrix_whatsapp_docker_image }}
|
{{ matrix_mautrix_whatsapp_docker_image }}
|
||||||
/usr/bin/mautrix-whatsapp -g -c /data/config.yaml -r /data/registration.yaml
|
/usr/bin/mautrix-whatsapp -g -c /data/config.yaml -r /data/registration.yaml
|
||||||
when: "matrix_mautrix_whatsapp_enabled and not mautrix_whatsapp_registration_file_stat.stat.exists"
|
when: "not mautrix_whatsapp_registration_file_stat.stat.exists"
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_synapse_app_service_config_file_mautrix_whatsapp: '/app-registration/mautrix-whatsapp.yml'
|
matrix_synapse_app_service_config_file_mautrix_whatsapp: '/app-registration/mautrix-whatsapp.yml'
|
||||||
when: "matrix_mautrix_whatsapp_enabled"
|
|
||||||
|
|
||||||
|
# If the matrix-synapse role is not used, these variables may not exist.
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_synapse_container_additional_volumes: >
|
matrix_synapse_container_additional_volumes: >
|
||||||
{{ matrix_synapse_container_additional_volumes }}
|
{{ matrix_synapse_container_additional_volumes|default([]) }}
|
||||||
+
|
+
|
||||||
{{ [{'src': '{{ matrix_mautrix_whatsapp_base_path }}/registration.yaml', 'dst': '{{ matrix_synapse_app_service_config_file_mautrix_whatsapp }}', 'options': 'ro'}] }}
|
{{ [{'src': '{{ matrix_mautrix_whatsapp_base_path }}/registration.yaml', 'dst': '{{ matrix_synapse_app_service_config_file_mautrix_whatsapp }}', 'options': 'ro'}] }}
|
||||||
when: "matrix_mautrix_whatsapp_enabled"
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
matrix_synapse_app_service_config_files: >
|
matrix_synapse_app_service_config_files: >
|
||||||
{{ matrix_synapse_app_service_config_files }}
|
{{ matrix_synapse_app_service_config_files|default([]) }}
|
||||||
+
|
+
|
||||||
{{ ["{{ matrix_synapse_app_service_config_file_mautrix_whatsapp }}"] | to_nice_json }}
|
{{ ["{{ matrix_synapse_app_service_config_file_mautrix_whatsapp }}"] | to_nice_json }}
|
||||||
when: "matrix_mautrix_whatsapp_enabled"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Tasks related to getting rid of matrix-mautrix-whatsapp (if it was previously enabled)
|
|
||||||
#
|
|
||||||
|
|
||||||
- name: Ensure matrix-mautrix-whatsapp.service doesn't exist
|
|
||||||
file:
|
|
||||||
path: "/etc/systemd/system/matrix-mautrix-whatsapp.service"
|
|
||||||
state: absent
|
|
||||||
when: "not matrix_mautrix_whatsapp_enabled"
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Ensure matrix-mautrix-whatsapp.service doesn't exist
|
||||||
|
file:
|
||||||
|
path: "/etc/systemd/system/matrix-mautrix-whatsapp.service"
|
||||||
|
state: absent
|
|
@ -2,15 +2,15 @@
|
||||||
# Homeserver details.
|
# Homeserver details.
|
||||||
homeserver:
|
homeserver:
|
||||||
# The address that this appservice can use to connect to the homeserver.
|
# The address that this appservice can use to connect to the homeserver.
|
||||||
address: https://{{ matrix_server_fqn_matrix }}
|
address: {{ matrix_mautrix_whatsapp_homeserver_address }}
|
||||||
# The domain of the homeserver (for MXIDs, etc).
|
# The domain of the homeserver (for MXIDs, etc).
|
||||||
domain: {{ matrix_domain }}
|
domain: {{ matrix_mautrix_whatsapp_homeserver_domain }}
|
||||||
|
|
||||||
# Application service host/registration related details.
|
# Application service host/registration related details.
|
||||||
# Changing these values requires regeneration of the registration.
|
# Changing these values requires regeneration of the registration.
|
||||||
appservice:
|
appservice:
|
||||||
# The address that the homeserver can use to connect to this appservice.
|
# The address that the homeserver can use to connect to this appservice.
|
||||||
address: http://matrix-mautrix-whatsapp:8080
|
address: {{ matrix_mautrix_whatsapp_appservice_address }}
|
||||||
|
|
||||||
# The hostname and port where this appservice should listen.
|
# The hostname and port where this appservice should listen.
|
||||||
hostname: 0.0.0.0
|
hostname: 0.0.0.0
|
||||||
|
@ -68,7 +68,7 @@ bridge:
|
||||||
# domain - All users on that homeserver
|
# domain - All users on that homeserver
|
||||||
# mxid - Specific user
|
# mxid - Specific user
|
||||||
permissions:
|
permissions:
|
||||||
'{{ matrix_domain }}': user
|
'{{ matrix_mautrix_whatsapp_homeserver_domain }}': user
|
||||||
|
|
||||||
# Logging config.
|
# Logging config.
|
||||||
logging:
|
logging:
|
|
@ -1,10 +1,13 @@
|
||||||
#jinja2: lstrip_blocks: "True"
|
#jinja2: lstrip_blocks: "True"
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Matrix Mautrix Whatsapp server
|
Description=Matrix Mautrix Whatsapp server
|
||||||
After=docker.service
|
{% for service in matrix_mautrix_whatsapp_systemd_required_services_list %}
|
||||||
Requires=docker.service
|
Requires={{ service }}
|
||||||
Requires=matrix-synapse.service
|
After={{ service }}
|
||||||
After=matrix-synapse.service
|
{% endfor %}
|
||||||
|
{% for service in matrix_mautrix_whatsapp_systemd_wanted_services_list %}
|
||||||
|
Wants={{ service }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
@ -18,6 +21,9 @@ ExecStart=/usr/bin/docker run --rm --name matrix-mautrix-whatsapp \
|
||||||
--network={{ matrix_docker_network }} \
|
--network={{ matrix_docker_network }} \
|
||||||
-v {{ matrix_mautrix_whatsapp_base_path }}:/data:z \
|
-v {{ matrix_mautrix_whatsapp_base_path }}:/data:z \
|
||||||
--workdir=/data \
|
--workdir=/data \
|
||||||
|
{% for arg in matrix_mautrix_whatsapp_container_extra_arguments %}
|
||||||
|
{{ arg }} \
|
||||||
|
{% endfor %}
|
||||||
{{ matrix_mautrix_whatsapp_docker_image }} \
|
{{ matrix_mautrix_whatsapp_docker_image }} \
|
||||||
/usr/bin/mautrix-whatsapp
|
/usr/bin/mautrix-whatsapp
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
# Synapse is a Matrix homeserver
|
||||||
|
# See: https://github.com/matrix-org/synapse
|
||||||
|
|
||||||
|
matrix_synapse_enabled: true
|
||||||
|
|
||||||
matrix_synapse_docker_image: "matrixdotorg/synapse:v0.99.4"
|
matrix_synapse_docker_image: "matrixdotorg/synapse:v0.99.4"
|
||||||
|
|
||||||
matrix_synapse_base_path: "{{ matrix_base_data_path }}/synapse"
|
matrix_synapse_base_path: "{{ matrix_base_data_path }}/synapse"
|
||||||
|
@ -15,12 +20,6 @@ matrix_synapse_container_expose_client_api_port: false
|
||||||
# that would be on another port (tcp/8448) controlled by `matrix_synapse_tls_federation_listener_enabled`.
|
# that would be on another port (tcp/8448) controlled by `matrix_synapse_tls_federation_listener_enabled`.
|
||||||
matrix_synapse_container_expose_federation_api_port: false
|
matrix_synapse_container_expose_federation_api_port: false
|
||||||
|
|
||||||
# Controls whether the Appservice IRC container exposes the Client/Server API port (tcp/9999).
|
|
||||||
matrix_appservice_irc_container_expose_client_server_api_port: false
|
|
||||||
|
|
||||||
# Controls whether the Appservice Discord container exposes the Client/Server API port (tcp/9005).
|
|
||||||
matrix_appservice_discord_container_expose_client_server_api_port: false
|
|
||||||
|
|
||||||
# Controls whether the matrix-synapse container exposes the metrics port (tcp/9100).
|
# Controls whether the matrix-synapse container exposes the metrics port (tcp/9100).
|
||||||
matrix_synapse_container_expose_metrics_port: false
|
matrix_synapse_container_expose_metrics_port: false
|
||||||
|
|
||||||
|
@ -239,587 +238,6 @@ matrix_s3_media_store_region: "eu-central-1"
|
||||||
# Controls whether the self-check feature should validate SSL certificates.
|
# Controls whether the self-check feature should validate SSL certificates.
|
||||||
matrix_synapse_self_check_validate_certificates: true
|
matrix_synapse_self_check_validate_certificates: true
|
||||||
|
|
||||||
# Matrix mautrix is a Matrix <-> Telegram bridge
|
|
||||||
# Enable telegram bridge
|
|
||||||
matrix_mautrix_telegram_enabled: false
|
|
||||||
|
|
||||||
matrix_mautrix_telegram_docker_image: "tulir/mautrix-telegram:v0.5.1"
|
|
||||||
|
|
||||||
matrix_mautrix_telegram_base_path: "{{ matrix_base_data_path }}/mautrix-telegram"
|
|
||||||
|
|
||||||
# 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
|
|
||||||
# Mautrix telegram public endpoint to log in to telegram
|
|
||||||
# Use an uuid so it's not easily discoverable
|
|
||||||
matrix_mautrix_telegram_public_endpoint: "/{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'telegram') | to_uuid }}"
|
|
||||||
# Set this to a port number to expose on the host when not using the nginx proxy
|
|
||||||
matrix_mautrix_telegram_container_exposed_port_number: ~
|
|
||||||
|
|
||||||
# Matrix mautrix is a Matrix <-> Whatsapp bridge
|
|
||||||
# Enable whatsapp bridge
|
|
||||||
matrix_mautrix_whatsapp_enabled: false
|
|
||||||
|
|
||||||
matrix_mautrix_whatsapp_docker_image: "tulir/mautrix-whatsapp:latest"
|
|
||||||
|
|
||||||
matrix_mautrix_whatsapp_base_path: "{{ matrix_base_data_path }}/mautrix-whatsapp"
|
|
||||||
|
|
||||||
# Matrix mautrix is a Matrix <-> Facebook bridge
|
|
||||||
# Enable facebook bridge
|
|
||||||
matrix_mautrix_facebook_enabled: false
|
|
||||||
|
|
||||||
matrix_mautrix_facebook_docker_image: "tulir/mautrix-facebook:latest"
|
|
||||||
|
|
||||||
matrix_mautrix_facebook_base_path: "{{ matrix_base_data_path }}/mautrix-facebook"
|
|
||||||
|
|
||||||
# Get your own API keys at https://developers.facebook.com/docs/apis-and-sdks/
|
|
||||||
matrix_mautrix_facebook_api_id: YOUR_FACEBOOK_APP_ID
|
|
||||||
matrix_mautrix_facebook_api_hash: YOUR_FACEBOOK_API_HASH
|
|
||||||
|
|
||||||
# Matrix Appservice IRC is a Matrix <-> IRC bridge
|
|
||||||
# Enable IRC bridge
|
|
||||||
matrix_appservice_irc_enabled: false
|
|
||||||
|
|
||||||
matrix_appservice_irc_docker_image: "tedomum/matrix-appservice-irc:latest"
|
|
||||||
|
|
||||||
matrix_appservice_irc_base_path: "{{ matrix_base_data_path }}/appservice-irc"
|
|
||||||
|
|
||||||
matrix_appservice_irc_configuration_yaml: |
|
|
||||||
#jinja2: lstrip_blocks: True
|
|
||||||
homeserver:
|
|
||||||
url: "https://{{ matrix_server_fqn_matrix }}"
|
|
||||||
domain: "{{ matrix_domain }}"
|
|
||||||
enablePresence: true
|
|
||||||
|
|
||||||
matrix_appservice_irc_configuration_extension_yaml: |
|
|
||||||
# Your custom YAML configuration for Appservice IRC servers goes here.
|
|
||||||
# This configuration extends the default starting configuration (`matrix_appservice_irc_configuration_yaml`).
|
|
||||||
#
|
|
||||||
# You can override individual variables from the default configuration, or introduce new ones.
|
|
||||||
#
|
|
||||||
# If you need something more special, you can take full control by
|
|
||||||
# completely redefining `matrix_appservice_irc_configuration_yaml`.
|
|
||||||
#
|
|
||||||
# Example configuration extension follows:
|
|
||||||
#
|
|
||||||
# ircService:
|
|
||||||
# databaseUri: "nedb:///data" # does not typically need modification
|
|
||||||
# passwordEncryptionKeyPath: "/data/passkey.pem" # does not typically need modification
|
|
||||||
# matrixHandler:
|
|
||||||
# eventCacheSize: 4096
|
|
||||||
# servers:
|
|
||||||
# # The address of the server to connect to.
|
|
||||||
# irc.example.com:
|
|
||||||
# # A human-readable short name. This is used to label IRC status rooms
|
|
||||||
# # where matrix users control their connections.
|
|
||||||
# # E.g. 'ExampleNet IRC Bridge status'.
|
|
||||||
# # It is also used in the Third Party Lookup API as the instance `desc`
|
|
||||||
# # property, where each server is an instance.
|
|
||||||
# name: "ExampleNet"
|
|
||||||
#
|
|
||||||
# additionalAddresses: [ "irc2.example.com" ]
|
|
||||||
# #
|
|
||||||
# # [DEPRECATED] Use `name`, above, instead.
|
|
||||||
# # A human-readable description string
|
|
||||||
# # description: "Example.com IRC network"
|
|
||||||
#
|
|
||||||
# # An ID for uniquely identifying this server amongst other servers being bridged.
|
|
||||||
# # networkId: "example"
|
|
||||||
#
|
|
||||||
# # URL to an icon used as the network icon whenever this network appear in
|
|
||||||
# # a network list. (Like in the riot room directory, for instance.)
|
|
||||||
# # icon: https://example.com/images/hash.png
|
|
||||||
#
|
|
||||||
# # The port to connect to. Optional.
|
|
||||||
# port: 6697
|
|
||||||
# # Whether to use SSL or not. Default: false.
|
|
||||||
# ssl: true
|
|
||||||
# # Whether or not IRC server is using a self-signed cert or not providing CA Chain
|
|
||||||
# sslselfsign: false
|
|
||||||
# # Should the connection attempt to identify via SASL (if a server or user password is given)
|
|
||||||
# # If false, this will use PASS instead. If SASL fails, we do not fallback to PASS.
|
|
||||||
# sasl: false
|
|
||||||
# # Whether to allow expired certs when connecting to the IRC server.
|
|
||||||
# # Usually this should be off. Default: false.
|
|
||||||
# allowExpiredCerts: false
|
|
||||||
# # A specific CA to trust instead of the default CAs. Optional.
|
|
||||||
# #ca: |
|
|
||||||
# # -----BEGIN CERTIFICATE-----
|
|
||||||
# # ...
|
|
||||||
# # -----END CERTIFICATE-----
|
|
||||||
#
|
|
||||||
# #
|
|
||||||
# # The connection password to send for all clients as a PASS (or SASL, if enabled above) command. Optional.
|
|
||||||
# # password: 'pa$$w0rd'
|
|
||||||
# #
|
|
||||||
# # Whether or not to send connection/error notices to real Matrix users. Default: true.
|
|
||||||
# sendConnectionMessages: true
|
|
||||||
#
|
|
||||||
# quitDebounce:
|
|
||||||
# # Whether parts due to net-splits are debounced for delayMs, to allow
|
|
||||||
# # time for the netsplit to resolve itself. A netsplit is detected as being
|
|
||||||
# # a QUIT rate higher than quitsPerSecond. Default: false.
|
|
||||||
# enabled: false
|
|
||||||
# # The maximum number of quits per second acceptable above which a netsplit is
|
|
||||||
# # considered ongoing. Default: 5.
|
|
||||||
# quitsPerSecond: 5
|
|
||||||
# # The time window in which to wait before bridging a QUIT to Matrix that occurred during
|
|
||||||
# # a netsplit. Debouncing is jittered randomly between delayMinMs and delayMaxMs so that the HS
|
|
||||||
# # is not sent many requests to leave rooms all at once if a netsplit occurs and many
|
|
||||||
# # people to not rejoin.
|
|
||||||
# # If the user with the same IRC nick as the one who sent the quit rejoins a channel
|
|
||||||
# # they are considered back online and the quit is not bridged, so long as the rejoin
|
|
||||||
# # occurs before the randomly-jittered timeout is not reached.
|
|
||||||
# # Default: 3600000, = 1h
|
|
||||||
# delayMinMs: 3600000 # 1h
|
|
||||||
# # Default: 7200000, = 2h
|
|
||||||
# delayMaxMs: 7200000 # 2h
|
|
||||||
#
|
|
||||||
# # A map for conversion of IRC user modes to Matrix power levels. This enables bridging
|
|
||||||
# # of IRC ops to Matrix power levels only, it does not enable the reverse. If a user has
|
|
||||||
# # been given multiple modes, the one that maps to the highest power level will be used.
|
|
||||||
# modePowerMap:
|
|
||||||
# o: 50
|
|
||||||
#
|
|
||||||
# botConfig:
|
|
||||||
# # Enable the presence of the bot in IRC channels. The bot serves as the entity
|
|
||||||
# # which maps from IRC -> Matrix. You can disable the bot entirely which
|
|
||||||
# # means IRC -> Matrix chat will be shared by active "M-Nick" connections
|
|
||||||
# # in the room. If there are no users in the room (or if there are users
|
|
||||||
# # but their connections are not on IRC) then nothing will be bridged to
|
|
||||||
# # Matrix. If you're concerned about the bot being treated as a "logger"
|
|
||||||
# # entity, then you may want to disable the bot. If you want IRC->Matrix
|
|
||||||
# # but don't want to have TCP connections to IRC unless a Matrix user speaks
|
|
||||||
# # (because your client connection limit is low), then you may want to keep
|
|
||||||
# # the bot enabled. Default: true.
|
|
||||||
# # NB: If the bot is disabled, you SHOULD have matrix-to-IRC syncing turned
|
|
||||||
# # on, else there will be no users and no bot in a channel (meaning no
|
|
||||||
# # messages to Matrix!) until a Matrix user speaks which makes a client
|
|
||||||
# # join the target IRC channel.
|
|
||||||
# # NBB: The bridge bot IRC client will still join the target IRC network so
|
|
||||||
# # it can service bridge-specific queries from the IRC-side e.g. so
|
|
||||||
# # real IRC clients have a way to change their Matrix display name.
|
|
||||||
# # See https://github.com/matrix-org/matrix-appservice-irc/issues/55
|
|
||||||
# enabled: true
|
|
||||||
# # The nickname to give the AS bot.
|
|
||||||
# nick: "MatrixBot"
|
|
||||||
# # The password to give to NickServ or IRC Server for this nick. Optional.
|
|
||||||
# # password: "helloworld"
|
|
||||||
# #
|
|
||||||
# # Join channels even if there are no Matrix users on the other side of
|
|
||||||
# # the bridge. Set to false to prevent the bot from joining channels which have no
|
|
||||||
# # real matrix users in them, even if there is a mapping for the channel.
|
|
||||||
# # Default: true
|
|
||||||
# joinChannelsIfNoUsers: true
|
|
||||||
#
|
|
||||||
# # Configuration for PMs / private 1:1 communications between users.
|
|
||||||
# privateMessages:
|
|
||||||
# # Enable the ability for PMs to be sent to/from IRC/Matrix.
|
|
||||||
# # Default: true.
|
|
||||||
# enabled: true
|
|
||||||
# # Prevent Matrix users from sending PMs to the following IRC nicks.
|
|
||||||
# # Optional. Default: [].
|
|
||||||
# # exclude: ["Alice", "Bob"] # NOT YET IMPLEMENTED
|
|
||||||
#
|
|
||||||
# # Should created Matrix PM rooms be federated? If false, only users on the
|
|
||||||
# # HS attached to this AS will be able to interact with this room.
|
|
||||||
# # Optional. Default: true.
|
|
||||||
# federate: true
|
|
||||||
#
|
|
||||||
# # Configuration for mappings not explicitly listed in the 'mappings'
|
|
||||||
# # section.
|
|
||||||
# dynamicChannels:
|
|
||||||
# # Enable the ability for Matrix users to join *any* channel on this IRC
|
|
||||||
# # network.
|
|
||||||
# # Default: false.
|
|
||||||
# enabled: true
|
|
||||||
# # Should the AS create a room alias for the new Matrix room? The form of
|
|
||||||
# # the alias can be modified via 'aliasTemplate'. Default: true.
|
|
||||||
# createAlias: true
|
|
||||||
# # Should the AS publish the new Matrix room to the public room list so
|
|
||||||
# # anyone can see it? Default: true.
|
|
||||||
# published: true
|
|
||||||
# # What should the join_rule be for the new Matrix room? If 'public',
|
|
||||||
# # anyone can join the room. If 'invite', only users with an invite can
|
|
||||||
# # join the room. Note that if an IRC channel has +k or +i set on it,
|
|
||||||
# # join_rules will be set to 'invite' until these modes are removed.
|
|
||||||
# # Default: "public".
|
|
||||||
# joinRule: public
|
|
||||||
# # This will set the m.room.related_groups state event in newly created rooms
|
|
||||||
# # with the given groupId. This means flares will show up on IRC users in those rooms.
|
|
||||||
# # This should be set to the same thing as namespaces.users.group_id in irc_registration.
|
|
||||||
# # This does not alter existing rooms.
|
|
||||||
# # Leaving this option empty will not set the event.
|
|
||||||
# groupId: +myircnetwork:localhost
|
|
||||||
# # Should created Matrix rooms be federated? If false, only users on the
|
|
||||||
# # HS attached to this AS will be able to interact with this room.
|
|
||||||
# # Default: true.
|
|
||||||
# federate: true
|
|
||||||
# # The room alias template to apply when creating new aliases. This only
|
|
||||||
# # applies if createAlias is 'true'. The following variables are exposed:
|
|
||||||
# # $SERVER => The IRC server address (e.g. "irc.example.com")
|
|
||||||
# # $CHANNEL => The IRC channel (e.g. "#python")
|
|
||||||
# # This MUST have $CHANNEL somewhere in it.
|
|
||||||
# # Default: '#irc_$SERVER_$CHANNEL'
|
|
||||||
# aliasTemplate: "#irc_$CHANNEL"
|
|
||||||
# # A list of user IDs which the AS bot will send invites to in response
|
|
||||||
# # to a !join. Only applies if joinRule is 'invite'. Default: []
|
|
||||||
# # whitelist:
|
|
||||||
# # - "@foo:example.com"
|
|
||||||
# # - "@bar:example.com"
|
|
||||||
# #
|
|
||||||
# # Prevent the given list of channels from being mapped under any
|
|
||||||
# # circumstances.
|
|
||||||
# # exclude: ["#foo", "#bar"]
|
|
||||||
#
|
|
||||||
# # Configuration for controlling how Matrix and IRC membership lists are
|
|
||||||
# # synced.
|
|
||||||
# membershipLists:
|
|
||||||
# # Enable the syncing of membership lists between IRC and Matrix. This
|
|
||||||
# # can have a significant effect on performance on startup as the lists are
|
|
||||||
# # synced. This must be enabled for anything else in this section to take
|
|
||||||
# # effect. Default: false.
|
|
||||||
# enabled: false
|
|
||||||
#
|
|
||||||
# # Syncing membership lists at startup can result in hundreds of members to
|
|
||||||
# # process all at once. This timer drip feeds membership entries at the
|
|
||||||
# # specified rate. Default: 10000. (10s)
|
|
||||||
# floodDelayMs: 10000
|
|
||||||
#
|
|
||||||
# global:
|
|
||||||
# ircToMatrix:
|
|
||||||
# # Get a snapshot of all real IRC users on a channel (via NAMES) and
|
|
||||||
# # join their virtual matrix clients to the room.
|
|
||||||
# initial: false
|
|
||||||
# # Make virtual matrix clients join and leave rooms as their real IRC
|
|
||||||
# # counterparts join/part channels. Default: false.
|
|
||||||
# incremental: false
|
|
||||||
#
|
|
||||||
# matrixToIrc:
|
|
||||||
# # Get a snapshot of all real Matrix users in the room and join all of
|
|
||||||
# # them to the mapped IRC channel on startup. Default: false.
|
|
||||||
# initial: false
|
|
||||||
# # Make virtual IRC clients join and leave channels as their real Matrix
|
|
||||||
# # counterparts join/leave rooms. Make sure your 'maxClients' value is
|
|
||||||
# # high enough! Default: false.
|
|
||||||
# incremental: false
|
|
||||||
#
|
|
||||||
# # Apply specific rules to Matrix rooms. Only matrix-to-IRC takes effect.
|
|
||||||
# rooms:
|
|
||||||
# - room: "!fuasirouddJoxtwfge:localhost"
|
|
||||||
# matrixToIrc:
|
|
||||||
# initial: false
|
|
||||||
# incremental: false
|
|
||||||
#
|
|
||||||
# # Apply specific rules to IRC channels. Only IRC-to-matrix takes effect.
|
|
||||||
# channels:
|
|
||||||
# - channel: "#foo"
|
|
||||||
# ircToMatrix:
|
|
||||||
# initial: false
|
|
||||||
# incremental: false
|
|
||||||
#
|
|
||||||
# mappings:
|
|
||||||
# # 1:many mappings from IRC channels to room IDs on this IRC server.
|
|
||||||
# # The matrix room must already exist. Your matrix client should expose
|
|
||||||
# # the room ID in a "settings" page for the room.
|
|
||||||
# "#thepub": ["!kieouiJuedJoxtVdaG:localhost"]
|
|
||||||
#
|
|
||||||
# # Configuration for virtual matrix users. The following variables are
|
|
||||||
# # exposed:
|
|
||||||
# # $NICK => The IRC nick
|
|
||||||
# # $SERVER => The IRC server address (e.g. "irc.example.com")
|
|
||||||
# matrixClients:
|
|
||||||
# # The user ID template to use when creating virtual matrix users. This
|
|
||||||
# # MUST have $NICK somewhere in it.
|
|
||||||
# # Optional. Default: "@$SERVER_$NICK".
|
|
||||||
# # Example: "@irc.example.com_Alice:example.com"
|
|
||||||
# userTemplate: "@irc_$NICK"
|
|
||||||
# # The display name to use for created matrix clients. This should have
|
|
||||||
# # $NICK somewhere in it if it is specified. Can also use $SERVER to
|
|
||||||
# # insert the IRC domain.
|
|
||||||
# # Optional. Default: "$NICK (IRC)". Example: "Alice (IRC)"
|
|
||||||
# displayName: "$NICK (IRC)"
|
|
||||||
# # Number of tries a client can attempt to join a room before the request
|
|
||||||
# # is discarded. You can also use -1 to never retry or 0 to never give up.
|
|
||||||
# # Optional. Default: -1
|
|
||||||
# joinAttempts: -1
|
|
||||||
#
|
|
||||||
# # Configuration for virtual IRC users. The following variables are exposed:
|
|
||||||
# # $LOCALPART => The user ID localpart ("alice" in @alice:localhost)
|
|
||||||
# # $USERID => The user ID
|
|
||||||
# # $DISPLAY => The display name of this user, with excluded characters
|
|
||||||
# # (e.g. space) removed. If the user has no display name, this
|
|
||||||
# # falls back to $LOCALPART.
|
|
||||||
# ircClients:
|
|
||||||
# # The template to apply to every IRC client nick. This MUST have either
|
|
||||||
# # $DISPLAY or $USERID or $LOCALPART somewhere in it.
|
|
||||||
# # Optional. Default: "M-$DISPLAY". Example: "M-Alice".
|
|
||||||
# nickTemplate: "$DISPLAY[m]"
|
|
||||||
# # True to allow virtual IRC clients to change their nick on this server
|
|
||||||
# # by issuing !nick <server> <nick> commands to the IRC AS bot.
|
|
||||||
# # This is completely freeform: it will NOT follow the nickTemplate.
|
|
||||||
# allowNickChanges: true
|
|
||||||
# # The max number of IRC clients that will connect. If the limit is
|
|
||||||
# # reached, the client that spoke the longest time ago will be
|
|
||||||
# # disconnected and replaced.
|
|
||||||
# # Optional. Default: 30.
|
|
||||||
# maxClients: 30
|
|
||||||
# # IPv6 configuration.
|
|
||||||
# ipv6:
|
|
||||||
# # Optional. Set to true to force IPv6 for outgoing connections.
|
|
||||||
# only: false
|
|
||||||
# # Optional. The IPv6 prefix to use for generating unique addresses for each
|
|
||||||
# # connected user. If not specified, all users will connect from the same
|
|
||||||
# # (default) address. This may require additional OS-specific work to allow
|
|
||||||
# # for the node process to bind to multiple different source addresses
|
|
||||||
# # e.g IP_FREEBIND on Linux, which requires an LD_PRELOAD with the library
|
|
||||||
# # https://github.com/matrix-org/freebindfree as Node does not expose setsockopt.
|
|
||||||
# # prefix: "2001:0db8:85a3::" # modify appropriately
|
|
||||||
# #
|
|
||||||
# # The maximum amount of time in seconds that the client can exist
|
|
||||||
# # without sending another message before being disconnected. Use 0 to
|
|
||||||
# # not apply an idle timeout. This value is ignored if this IRC server is
|
|
||||||
# # mirroring matrix membership lists to IRC. Default: 172800 (48 hours)
|
|
||||||
# idleTimeout: 10800
|
|
||||||
# # The number of millseconds to wait between consecutive reconnections if a
|
|
||||||
# # client gets disconnected. Setting to 0 will cause the scheduling to be
|
|
||||||
# # disabled, i.e. it will be scheduled immediately (with jitter.
|
|
||||||
# # Otherwise, the scheduling interval will be used such that one client
|
|
||||||
# # reconnect for this server will be handled every reconnectIntervalMs ms using
|
|
||||||
# # a FIFO queue.
|
|
||||||
# # Default: 5000 (5 seconds)
|
|
||||||
# reconnectIntervalMs: 5000
|
|
||||||
# # The number of concurrent reconnects if a user has been disconnected unexpectedly
|
|
||||||
# # (e.g. a netsplit). You should set this to a reasonably high number so that
|
|
||||||
# # bridges are not waiting an eternity to reconnect all its clients if
|
|
||||||
# # we see a massive number of disconnect. This is unrelated to the reconnectIntervalMs
|
|
||||||
# # setting above which is for connecting on restart of the bridge. Set to 0 to
|
|
||||||
# # immediately try to reconnect all users.
|
|
||||||
# # Default: 50
|
|
||||||
# concurrentReconnectLimit: 50
|
|
||||||
# # The number of lines to allow being sent by the IRC client that has received
|
|
||||||
# # a large block of text to send from matrix. If the number of lines that would
|
|
||||||
# # be sent is > lineLimit, the text will instead be uploaded to matrix and the
|
|
||||||
# # resulting URI is treated as a file. As such, a link will be sent to the IRC
|
|
||||||
# # side instead of potentially spamming IRC and getting the IRC client kicked.
|
|
||||||
# # Default: 3.
|
|
||||||
# lineLimit: 3
|
|
||||||
# # A list of user modes to set on every IRC client. For example, "RiG" would set
|
|
||||||
# # +R, +i and +G on every IRC connection when they have successfully connected.
|
|
||||||
# # User modes vary wildly depending on the IRC network you're connecting to,
|
|
||||||
# # so check before setting this value. Some modes may not work as intended
|
|
||||||
# # through the bridge e.g. caller ID as there is no way to /ACCEPT.
|
|
||||||
# # Default: "" (no user modes)
|
|
||||||
# # userModes: "R"
|
|
||||||
#
|
|
||||||
# # Configuration for an ident server. If you are running a public bridge it is
|
|
||||||
# # advised you setup an ident server so IRC mods can ban specific matrix users
|
|
||||||
# # rather than the application service itself.
|
|
||||||
# ident:
|
|
||||||
# # True to listen for Ident requests and respond with the
|
|
||||||
# # matrix user's user_id (converted to ASCII, respecting RFC 1413).
|
|
||||||
# # Default: false.
|
|
||||||
# enabled: false
|
|
||||||
# # The port to listen on for incoming ident requests.
|
|
||||||
# # Ports below 1024 require root to listen on, and you may not want this to
|
|
||||||
# # run as root. Instead, you can get something like an Apache to yank up
|
|
||||||
# # incoming requests to 113 to a high numbered port. Set the port to listen
|
|
||||||
# # on instead of 113 here.
|
|
||||||
# # Default: 113.
|
|
||||||
# port: 1113
|
|
||||||
# # The address to listen on for incoming ident requests.
|
|
||||||
# # Default: 0.0.0.0
|
|
||||||
# address: "::"
|
|
||||||
#
|
|
||||||
# # Configuration for logging. Optional. Default: console debug level logging
|
|
||||||
# # only.
|
|
||||||
# logging:
|
|
||||||
# # Level to log on console/logfile. One of error|warn|info|debug
|
|
||||||
# level: "debug"
|
|
||||||
# # The file location to log to. This is relative to the project directory.
|
|
||||||
# logfile: "debug.log"
|
|
||||||
# # The file location to log errors to. This is relative to the project
|
|
||||||
# # directory.
|
|
||||||
# errfile: "errors.log"
|
|
||||||
# # Whether to log to the console or not.
|
|
||||||
# toConsole: true
|
|
||||||
# # The max number of files to keep. Files will be overwritten eventually due
|
|
||||||
# # to rotations.
|
|
||||||
# maxFiles: 5
|
|
||||||
#
|
|
||||||
# # Optional. Enable Prometheus metrics. If this is enabled, you MUST install `prom-client`:
|
|
||||||
# # $ npm install prom-client@6.3.0
|
|
||||||
# # Metrics will then be available via GET /metrics on the bridge listening port (-p).
|
|
||||||
# metrics:
|
|
||||||
# # Whether to actually enable the metric endpoint. Default: false
|
|
||||||
# enabled: true
|
|
||||||
# # When collecting remote user active times, which "buckets" should be used. Defaults are given below.
|
|
||||||
# # The bucket name is formed of a duration and a period. (h=hours,d=days,w=weeks).
|
|
||||||
# remoteUserAgeBuckets:
|
|
||||||
# - "1h"
|
|
||||||
# - "1d"
|
|
||||||
# - "1w"
|
|
||||||
#
|
|
||||||
# # Configuration options for the debug HTTP API. To access this API, you must
|
|
||||||
# # append ?access_token=$APPSERVICE_TOKEN (from the registration file) to the requests.
|
|
||||||
# #
|
|
||||||
# # The debug API exposes the following endpoints:
|
|
||||||
# #
|
|
||||||
# # GET /irc/$domain/user/$user_id => Return internal state for the IRC client for this user ID.
|
|
||||||
# #
|
|
||||||
# # POST /irc/$domain/user/$user_id => Issue a raw IRC command down this connection.
|
|
||||||
# # Format: new line delimited commands as per IRC protocol.
|
|
||||||
# #
|
|
||||||
# debugApi:
|
|
||||||
# # True to enable the HTTP API endpoint. Default: false.
|
|
||||||
# enabled: false
|
|
||||||
# # The port to host the HTTP API.
|
|
||||||
# port: 11100
|
|
||||||
#
|
|
||||||
# # Configuration for the provisioning API.
|
|
||||||
# #
|
|
||||||
# # GET /_matrix/provision/link
|
|
||||||
# # GET /_matrix/provision/unlink
|
|
||||||
# # GET /_matrix/provision/listlinks
|
|
||||||
# #
|
|
||||||
# provisioning:
|
|
||||||
# # True to enable the provisioning HTTP endpoint. Default: false.
|
|
||||||
# enabled: false
|
|
||||||
# # The number of seconds to wait before giving up on getting a response from
|
|
||||||
# # an IRC channel operator. If the channel operator does not respond within the
|
|
||||||
# # allotted time period, the provisioning request will fail.
|
|
||||||
# # Default: 300 seconds (5 mins)
|
|
||||||
# requestTimeoutSeconds: 300
|
|
||||||
#
|
|
||||||
# # WARNING: The bridge needs to send plaintext passwords to the IRC server, it cannot
|
|
||||||
# # send a password hash. As a result, passwords (NOT hashes) are stored encrypted in
|
|
||||||
# # the database.
|
|
||||||
# #
|
|
||||||
|
|
||||||
matrix_appservice_irc_configuration_extension: "{{ matrix_appservice_irc_configuration_extension_yaml|from_yaml if matrix_appservice_irc_configuration_extension_yaml|from_yaml else {} }}"
|
|
||||||
|
|
||||||
matrix_appservice_irc_configuration: "{{ matrix_appservice_irc_configuration_yaml|from_yaml|combine(matrix_appservice_irc_configuration_extension, recursive=True) }}"
|
|
||||||
|
|
||||||
|
|
||||||
# Matrix Appservice Discord is a Matrix <-> Discord bridge
|
|
||||||
# Enable Discord bridge
|
|
||||||
matrix_appservice_discord_enabled: false
|
|
||||||
|
|
||||||
matrix_appservice_discord_docker_image: "halfshot/matrix-appservice-discord:latest"
|
|
||||||
|
|
||||||
matrix_appservice_discord_base_path: "{{ matrix_base_data_path }}/appservice-discord"
|
|
||||||
|
|
||||||
matrix_appservice_discord_client_id: "YOUR DISCORD APP CLIENT ID"
|
|
||||||
matrix_appservice_discord_bot_token: "YOUR DISCORD APP BOT TOKEN"
|
|
||||||
|
|
||||||
matrix_appservice_discord_configuration_yaml: |
|
|
||||||
bridge:
|
|
||||||
domain: "{{ matrix_domain }}"
|
|
||||||
homeserverUrl: "{{ matrix_homeserver_url }}"
|
|
||||||
auth:
|
|
||||||
clientID: "{{matrix_appservice_discord_client_id}}"
|
|
||||||
botToken: "{{matrix_appservice_discord_bot_token}}"
|
|
||||||
database:
|
|
||||||
filename: "/data/discord.db"
|
|
||||||
userStorePath: "/data/user-store.db"
|
|
||||||
roomStorePath: "/data/room-store.db"
|
|
||||||
|
|
||||||
matrix_appservice_discord_configuration_extension_yaml: |
|
|
||||||
# This is a sample of the config file showing all avaliable options.
|
|
||||||
# Where possible we have documented what they do, and all values are the
|
|
||||||
# default values.
|
|
||||||
#
|
|
||||||
#bridge:
|
|
||||||
# # Domain part of the bridge, e.g. matrix.org
|
|
||||||
# domain: "localhost"
|
|
||||||
# # This should be your publically facing URL because Discord may use it to
|
|
||||||
# # fetch media from the media store.
|
|
||||||
# homeserverUrl: "http://localhost:8008"
|
|
||||||
# # Interval at which to process users in the 'presence queue'. If you have
|
|
||||||
# # 5 users, one user will be processed every 500 milliseconds according to the
|
|
||||||
# # value below. This has a minimum value of 250.
|
|
||||||
# # WARNING: This has a high chance of spamming the homeserver with presence
|
|
||||||
# # updates since it will send one each time somebody changes state or is online.
|
|
||||||
# presenceInterval: 500
|
|
||||||
# # Disable setting presence for 'ghost users' which means Discord users on Matrix
|
|
||||||
# # will not be shown as away or online.
|
|
||||||
# disablePresence: false
|
|
||||||
# # Disable sending typing notifications when somebody on Discord types.
|
|
||||||
# disableTypingNotifications: false
|
|
||||||
# # Disable deleting messages on Discord if a message is redacted on Matrix.
|
|
||||||
# disableDeletionForwarding: false
|
|
||||||
# # Enable users to bridge rooms using !discord commands. See
|
|
||||||
# # https://t2bot.io/discord for instructions.
|
|
||||||
# enableSelfServiceBridging: false
|
|
||||||
# # Disable sending of read receipts for Matrix events which have been
|
|
||||||
# # successfully bridged to Discord.
|
|
||||||
# disableReadReceipts: false
|
|
||||||
# Authentication configuration for the discord bot.
|
|
||||||
#auth:
|
|
||||||
# clientID: "12345"
|
|
||||||
# botToken: "foobar"
|
|
||||||
#logging:
|
|
||||||
# # What level should the logger output to the console at.
|
|
||||||
# console: "warn" #silly, verbose, info, http, warn, error, silent
|
|
||||||
# lineDateFormat: "MMM-D HH:mm:ss.SSS" # This is in moment.js format
|
|
||||||
# files:
|
|
||||||
# - file: "debug.log"
|
|
||||||
# disable:
|
|
||||||
# - "PresenceHandler" # Will not capture presence logging
|
|
||||||
# - file: "warn.log" # Will capture warnings
|
|
||||||
# level: "warn"
|
|
||||||
# - file: "botlogs.log" # Will capture logs from DiscordBot
|
|
||||||
# level: "info"
|
|
||||||
# enable:
|
|
||||||
# - "DiscordBot"
|
|
||||||
#database:
|
|
||||||
# userStorePath: "user-store.db"
|
|
||||||
# roomStorePath: "room-store.db"
|
|
||||||
# # You may either use SQLite or Postgresql for the bridge database, which contains
|
|
||||||
# # important mappings for events and user puppeting configurations.
|
|
||||||
# # Use the filename option for SQLite, or connString for Postgresql.
|
|
||||||
# # If you are migrating, see https://github.com/Half-Shot/matrix-appservice-discord/blob/master/docs/howto.md#migrate-to-postgres-from-sqlite
|
|
||||||
# # WARNING: You will almost certainly be fine with sqlite unless your bridge
|
|
||||||
# # is in heavy demand and you suffer from IO slowness.
|
|
||||||
# filename: "discord.db"
|
|
||||||
# # connString: "postgresql://user:password@localhost/database_name"
|
|
||||||
#room:
|
|
||||||
# # Set the default visibility of alias rooms, defaults to "public".
|
|
||||||
# # One of: "public", "private"
|
|
||||||
# defaultVisibility: "public"
|
|
||||||
#channel:
|
|
||||||
# # Pattern of the name given to bridged rooms.
|
|
||||||
# # Can use :guild for the guild name and :name for the channel name.
|
|
||||||
# namePattern: "[Discord] :guild :name"
|
|
||||||
# # Changes made to rooms when a channel is deleted.
|
|
||||||
# deleteOptions:
|
|
||||||
# # Prefix the room name with a string.
|
|
||||||
# #namePrefix: "[Deleted]"
|
|
||||||
# # Prefix the room topic with a string.
|
|
||||||
# #topicPrefix: "This room has been deleted"
|
|
||||||
# # Disable people from talking in the room by raising the event PL to 50
|
|
||||||
# disableMessaging: false
|
|
||||||
# # Remove the discord alias from the room.
|
|
||||||
# unsetRoomAlias: true
|
|
||||||
# # Remove the room from the directory.
|
|
||||||
# unlistFromDirectory: true
|
|
||||||
# # Set the room to be unavaliable for joining without an invite.
|
|
||||||
# setInviteOnly: true
|
|
||||||
# # Make all the discord users leave the room.
|
|
||||||
# ghostsLeave: true
|
|
||||||
#limits:
|
|
||||||
# # Delay in milliseconds between discord users joining a room.
|
|
||||||
# roomGhostJoinDelay: 6000
|
|
||||||
# # Delay in milliseconds before sending messages to discord to avoid echos.
|
|
||||||
# # (Copies of a sent message may arrive from discord before we've
|
|
||||||
# # fininished handling it, causing us to echo it back to the room)
|
|
||||||
# discordSendDelay: 750
|
|
||||||
|
|
||||||
matrix_appservice_discord_configuration_extension: "{{ matrix_appservice_discord_configuration_extension_yaml|from_yaml if matrix_appservice_discord_configuration_extension_yaml|from_yaml else {} }}"
|
|
||||||
|
|
||||||
matrix_appservice_discord_configuration: "{{ matrix_appservice_discord_configuration_yaml|from_yaml|combine(matrix_appservice_discord_configuration_extension, recursive=True) }}"
|
|
||||||
|
|
||||||
|
|
||||||
# Controls whether searching the public room list is enabled.
|
# Controls whether searching the public room list is enabled.
|
||||||
matrix_enable_room_list_search: true
|
matrix_enable_room_list_search: true
|
||||||
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/ext/mautrix-telegram/init.yml"
|
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/ext/mautrix-whatsapp/init.yml"
|
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/ext/mautrix-facebook/init.yml"
|
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/ext/appservice-irc/init.yml"
|
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/ext/appservice-discord/init.yml"
|
|
|
@ -1,48 +1,7 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
#
|
- import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup_install.yml"
|
||||||
# Tasks related to setting up matrix-synapse-rest-auth
|
when: matrix_synapse_ext_password_provider_rest_auth_enabled
|
||||||
#
|
|
||||||
|
|
||||||
- name: Fail if REST Auth enabled, but endpoint not configured
|
- import_tasks: "{{ role_path }}/tasks/ext/rest-auth/setup_uninstall.yml"
|
||||||
fail:
|
|
||||||
msg: "You have enabled the REST Auth password provider, but have not configured its endpoint in the `matrix_synapse_ext_password_provider_rest_auth_endpoint` variable. Consult the documentation."
|
|
||||||
when: "matrix_synapse_ext_password_provider_rest_auth_enabled and matrix_synapse_ext_password_provider_rest_auth_endpoint == ''"
|
|
||||||
|
|
||||||
- name: Download matrix-synapse-rest-auth
|
|
||||||
get_url:
|
|
||||||
url: "{{ matrix_synapse_ext_password_provider_rest_auth_download_url }}"
|
|
||||||
dest: "{{ matrix_synapse_ext_path }}/rest_auth_provider.py"
|
|
||||||
force: true
|
|
||||||
mode: 0440
|
|
||||||
owner: "{{ matrix_user_username }}"
|
|
||||||
group: "{{ matrix_user_username }}"
|
|
||||||
when: "matrix_synapse_ext_password_provider_rest_auth_enabled"
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
matrix_synapse_password_providers_enabled: true
|
|
||||||
when: "matrix_synapse_ext_password_provider_rest_auth_enabled"
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
matrix_synapse_container_additional_volumes: >
|
|
||||||
{{ matrix_synapse_container_additional_volumes }}
|
|
||||||
+
|
|
||||||
{{ [{'src': '{{ matrix_synapse_ext_path }}/rest_auth_provider.py', 'dst': '{{ matrix_synapse_in_container_python_packages_path }}/rest_auth_provider.py', 'options': 'ro'}] }}
|
|
||||||
when: "matrix_synapse_ext_password_provider_rest_auth_enabled"
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
matrix_synapse_additional_loggers: >
|
|
||||||
{{ matrix_synapse_additional_loggers }}
|
|
||||||
+
|
|
||||||
{{ [{'name': 'rest_auth_provider', 'level': 'INFO'}] }}
|
|
||||||
when: "matrix_synapse_ext_password_provider_rest_auth_enabled"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Tasks related to getting rid of matrix-synapse-rest-auth (if it was previously enabled)
|
|
||||||
#
|
|
||||||
|
|
||||||
- name: Ensure matrix-synapse-rest-auth doesn't exist
|
|
||||||
file:
|
|
||||||
path: "{{ matrix_synapse_ext_path }}/rest_auth_provider.py"
|
|
||||||
state: absent
|
|
||||||
when: "not matrix_synapse_ext_password_provider_rest_auth_enabled"
|
when: "not matrix_synapse_ext_password_provider_rest_auth_enabled"
|
30
roles/matrix-synapse/tasks/ext/rest-auth/setup_install.yml
Normal file
30
roles/matrix-synapse/tasks/ext/rest-auth/setup_install.yml
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Fail if REST Auth endpoint not configured
|
||||||
|
fail:
|
||||||
|
msg: "You have enabled the REST Auth password provider, but have not configured its endpoint in the `matrix_synapse_ext_password_provider_rest_auth_endpoint` variable. Consult the documentation."
|
||||||
|
when: "matrix_synapse_ext_password_provider_rest_auth_endpoint == ''"
|
||||||
|
|
||||||
|
- name: Download matrix-synapse-rest-auth
|
||||||
|
get_url:
|
||||||
|
url: "{{ matrix_synapse_ext_password_provider_rest_auth_download_url }}"
|
||||||
|
dest: "{{ matrix_synapse_ext_path }}/rest_auth_provider.py"
|
||||||
|
force: true
|
||||||
|
mode: 0440
|
||||||
|
owner: "{{ matrix_user_username }}"
|
||||||
|
group: "{{ matrix_user_username }}"
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
matrix_synapse_password_providers_enabled: true
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
matrix_synapse_container_additional_volumes: >
|
||||||
|
{{ matrix_synapse_container_additional_volumes }}
|
||||||
|
+
|
||||||
|
{{ [{'src': '{{ matrix_synapse_ext_path }}/rest_auth_provider.py', 'dst': '{{ matrix_synapse_in_container_python_packages_path }}/rest_auth_provider.py', 'options': 'ro'}] }}
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
matrix_synapse_additional_loggers: >
|
||||||
|
{{ matrix_synapse_additional_loggers }}
|
||||||
|
+
|
||||||
|
{{ [{'name': 'rest_auth_provider', 'level': 'INFO'}] }}
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Ensure matrix-synapse-rest-auth doesn't exist
|
||||||
|
file:
|
||||||
|
path: "{{ matrix_synapse_ext_path }}/rest_auth_provider.py"
|
||||||
|
state: absent
|
|
@ -5,13 +5,3 @@
|
||||||
- import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup.yml"
|
- import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup.yml"
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/ext/ldap-auth/setup.yml"
|
- import_tasks: "{{ role_path }}/tasks/ext/ldap-auth/setup.yml"
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/ext/mautrix-telegram/setup.yml"
|
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/ext/mautrix-whatsapp/setup.yml"
|
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/ext/mautrix-facebook/setup.yml"
|
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/ext/appservice-irc/setup.yml"
|
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/ext/appservice-discord/setup.yml"
|
|
||||||
|
|
|
@ -1,48 +1,7 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
#
|
- import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup_install.yml"
|
||||||
# Tasks related to setting up matrix-synapse-shared-secret-auth
|
when: matrix_synapse_ext_password_provider_shared_secret_auth_enabled
|
||||||
#
|
|
||||||
|
|
||||||
- name: Fail if Shared Secret Auth enabled, but no secret set
|
- import_tasks: "{{ role_path }}/tasks/ext/shared-secret-auth/setup_uninstall.yml"
|
||||||
fail:
|
|
||||||
msg: "Shared Secret Auth is enabled, but no secret has been set in matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret"
|
|
||||||
when: "matrix_synapse_ext_password_provider_shared_secret_auth_enabled and matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret == ''"
|
|
||||||
|
|
||||||
- name: Download matrix-synapse-shared-secret-auth
|
|
||||||
get_url:
|
|
||||||
url: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_download_url }}"
|
|
||||||
dest: "{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py"
|
|
||||||
force: true
|
|
||||||
mode: 0440
|
|
||||||
owner: "{{ matrix_user_username }}"
|
|
||||||
group: "{{ matrix_user_username }}"
|
|
||||||
when: "matrix_synapse_ext_password_provider_shared_secret_auth_enabled"
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
matrix_synapse_password_providers_enabled: true
|
|
||||||
when: "matrix_synapse_ext_password_provider_shared_secret_auth_enabled"
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
matrix_synapse_container_additional_volumes: >
|
|
||||||
{{ matrix_synapse_container_additional_volumes }}
|
|
||||||
+
|
|
||||||
{{ [{'src': '{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py', 'dst': '{{ matrix_synapse_in_container_python_packages_path }}/shared_secret_authenticator.py', 'options': 'ro'}] }}
|
|
||||||
when: "matrix_synapse_ext_password_provider_shared_secret_auth_enabled"
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
matrix_synapse_additional_loggers: >
|
|
||||||
{{ matrix_synapse_additional_loggers }}
|
|
||||||
+
|
|
||||||
{{ [{'name': 'shared_secret_authenticator', 'level': 'INFO'}] }}
|
|
||||||
when: "matrix_synapse_ext_password_provider_shared_secret_auth_enabled"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Tasks related to getting rid of matrix-synapse-shared-secret-auth (if it was previously enabled)
|
|
||||||
#
|
|
||||||
|
|
||||||
- name: Ensure matrix-synapse-shared-secret-auth doesn't exist
|
|
||||||
file:
|
|
||||||
path: "{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py"
|
|
||||||
state: absent
|
|
||||||
when: "not matrix_synapse_ext_password_provider_shared_secret_auth_enabled"
|
when: "not matrix_synapse_ext_password_provider_shared_secret_auth_enabled"
|
|
@ -0,0 +1,30 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Fail if Shared Secret Auth secret not set
|
||||||
|
fail:
|
||||||
|
msg: "Shared Secret Auth is enabled, but no secret has been set in matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret"
|
||||||
|
when: "matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret == ''"
|
||||||
|
|
||||||
|
- name: Download matrix-synapse-shared-secret-auth
|
||||||
|
get_url:
|
||||||
|
url: "{{ matrix_synapse_ext_password_provider_shared_secret_auth_download_url }}"
|
||||||
|
dest: "{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py"
|
||||||
|
force: true
|
||||||
|
mode: 0440
|
||||||
|
owner: "{{ matrix_user_username }}"
|
||||||
|
group: "{{ matrix_user_username }}"
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
matrix_synapse_password_providers_enabled: true
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
matrix_synapse_container_additional_volumes: >
|
||||||
|
{{ matrix_synapse_container_additional_volumes }}
|
||||||
|
+
|
||||||
|
{{ [{'src': '{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py', 'dst': '{{ matrix_synapse_in_container_python_packages_path }}/shared_secret_authenticator.py', 'options': 'ro'}] }}
|
||||||
|
|
||||||
|
- set_fact:
|
||||||
|
matrix_synapse_additional_loggers: >
|
||||||
|
{{ matrix_synapse_additional_loggers }}
|
||||||
|
+
|
||||||
|
{{ [{'name': 'shared_secret_authenticator', 'level': 'INFO'}] }}
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: Ensure matrix-synapse-shared-secret-auth doesn't exist
|
||||||
|
file:
|
||||||
|
path: "{{ matrix_synapse_ext_path }}/shared_secret_authenticator.py"
|
||||||
|
state: absent
|
7
roles/matrix-synapse/tasks/goofys/setup.yml
Normal file
7
roles/matrix-synapse/tasks/goofys/setup.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/goofys/setup_install.yml"
|
||||||
|
when: matrix_s3_media_store_enabled
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/goofys/setup_uninstall.yml"
|
||||||
|
when: "not matrix_s3_media_store_enabled"
|
38
roles/matrix-synapse/tasks/goofys/setup_install.yml
Normal file
38
roles/matrix-synapse/tasks/goofys/setup_install.yml
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
- name: Ensure Goofys Docker image is pulled
|
||||||
|
docker_image:
|
||||||
|
name: "{{ matrix_s3_goofys_docker_image }}"
|
||||||
|
|
||||||
|
# This will throw a Permission Denied error if already mounted
|
||||||
|
- name: Check Matrix Goofys external storage mountpoint path
|
||||||
|
stat:
|
||||||
|
path: "{{ matrix_synapse_media_store_path }}"
|
||||||
|
register: local_path_matrix_synapse_media_store_path_stat
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- name: Ensure Matrix Goofys external storage mountpoint exists
|
||||||
|
file:
|
||||||
|
path: "{{ matrix_synapse_media_store_path }}"
|
||||||
|
state: directory
|
||||||
|
mode: 0750
|
||||||
|
owner: "{{ matrix_user_uid }}"
|
||||||
|
group: "{{ matrix_user_gid }}"
|
||||||
|
when: "not local_path_matrix_synapse_media_store_path_stat.failed and not local_path_matrix_synapse_media_store_path_stat.stat.exists"
|
||||||
|
|
||||||
|
- name: Ensure goofys environment variables file created
|
||||||
|
template:
|
||||||
|
src: "{{ role_path }}/templates/goofys/env-goofys.j2"
|
||||||
|
dest: "{{ matrix_synapse_config_dir_path }}/env-goofys"
|
||||||
|
owner: root
|
||||||
|
mode: 0600
|
||||||
|
|
||||||
|
- name: Ensure matrix-goofys.service installed
|
||||||
|
template:
|
||||||
|
src: "{{ role_path }}/templates/goofys/systemd/matrix-goofys.service.j2"
|
||||||
|
dest: "/etc/systemd/system/matrix-goofys.service"
|
||||||
|
mode: 0644
|
||||||
|
register: matrix_goofys_systemd_service_result
|
||||||
|
|
||||||
|
- name: Ensure systemd reloaded after matrix-goofys.service installation
|
||||||
|
service:
|
||||||
|
daemon_reload: yes
|
||||||
|
when: "matrix_goofys_systemd_service_result.changed"
|
33
roles/matrix-synapse/tasks/goofys/setup_uninstall.yml
Normal file
33
roles/matrix-synapse/tasks/goofys/setup_uninstall.yml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
- name: Check existence of matrix-goofys service
|
||||||
|
stat:
|
||||||
|
path: "/etc/systemd/system/matrix-goofys.service"
|
||||||
|
register: matrix_goofys_service_stat
|
||||||
|
|
||||||
|
- name: Ensure matrix-goofys is stopped
|
||||||
|
service:
|
||||||
|
name: matrix-goofys
|
||||||
|
state: stopped
|
||||||
|
daemon_reload: yes
|
||||||
|
register: stopping_result
|
||||||
|
when: "matrix_goofys_service_stat.stat.exists"
|
||||||
|
|
||||||
|
- name: Ensure matrix-goofys.service doesn't exist
|
||||||
|
file:
|
||||||
|
path: "/etc/systemd/system/matrix-goofys.service"
|
||||||
|
state: absent
|
||||||
|
when: "matrix_goofys_service_stat.stat.exists"
|
||||||
|
|
||||||
|
- name: Ensure systemd reloaded after matrix-goofys.service removal
|
||||||
|
service:
|
||||||
|
daemon_reload: yes
|
||||||
|
when: "matrix_goofys_service_stat.stat.exists"
|
||||||
|
|
||||||
|
- name: Ensure goofys environment variables file doesn't exist
|
||||||
|
file:
|
||||||
|
path: "{{ matrix_synapse_config_dir_path }}/env-goofys"
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Ensure Goofys Docker image doesn't exist
|
||||||
|
docker_image:
|
||||||
|
name: "{{ matrix_s3_goofys_docker_image }}"
|
||||||
|
state: absent
|
|
@ -1,8 +1,7 @@
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-synapse'] }}"
|
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-synapse'] }}"
|
||||||
|
when: matrix_synapse_enabled
|
||||||
|
|
||||||
- set_fact:
|
- set_fact:
|
||||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-goofys'] }}"
|
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-goofys'] }}"
|
||||||
when: matrix_s3_media_store_enabled
|
when: matrix_s3_media_store_enabled
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/ext/init.yml"
|
|
|
@ -8,7 +8,7 @@
|
||||||
- setup-all
|
- setup-all
|
||||||
- setup-synapse
|
- setup-synapse
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/setup_synapse_entrypoint.yml"
|
- import_tasks: "{{ role_path }}/tasks/setup_synapse.yml"
|
||||||
when: run_setup
|
when: run_setup
|
||||||
tags:
|
tags:
|
||||||
- setup-all
|
- setup-all
|
||||||
|
@ -42,3 +42,9 @@
|
||||||
when: run_update_user_password
|
when: run_update_user_password
|
||||||
tags:
|
tags:
|
||||||
- update-user-password
|
- update-user-password
|
||||||
|
|
||||||
|
- name: Mark matrix-synapse role as executed
|
||||||
|
set_fact:
|
||||||
|
matrix_synapse_role_executed: true
|
||||||
|
tags:
|
||||||
|
- always
|
||||||
|
|
|
@ -7,12 +7,14 @@
|
||||||
validate_certs: "{{ matrix_synapse_self_check_validate_certificates }}"
|
validate_certs: "{{ matrix_synapse_self_check_validate_certificates }}"
|
||||||
register: result_matrix_synapse_client_api
|
register: result_matrix_synapse_client_api
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
when: matrix_synapse_enabled
|
||||||
|
|
||||||
- name: Fail if Matrix Client API not working
|
- name: Fail if Matrix Client API not working
|
||||||
fail:
|
fail:
|
||||||
msg: "Failed checking Matrix Client API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_client_api_url_endpoint_public }}`). Is Synapse running? Is port 443 open in your firewall? Full error: {{ result_matrix_synapse_client_api }}"
|
msg: "Failed checking Matrix Client API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_client_api_url_endpoint_public }}`). Is Synapse running? Is port 443 open in your firewall? Full error: {{ result_matrix_synapse_client_api }}"
|
||||||
when: "result_matrix_synapse_client_api.failed or 'json' not in result_matrix_synapse_client_api"
|
when: "matrix_synapse_enabled and (result_matrix_synapse_client_api.failed or 'json' not in result_matrix_synapse_client_api)"
|
||||||
|
|
||||||
- name: Report working Matrix Client API
|
- name: Report working Matrix Client API
|
||||||
debug:
|
debug:
|
||||||
msg: "The Matrix Client API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_client_api_url_endpoint_public }}`) is working"
|
msg: "The Matrix Client API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_client_api_url_endpoint_public }}`) is working"
|
||||||
|
when: matrix_synapse_enabled
|
||||||
|
|
|
@ -7,18 +7,19 @@
|
||||||
validate_certs: "{{ matrix_synapse_self_check_validate_certificates }}"
|
validate_certs: "{{ matrix_synapse_self_check_validate_certificates }}"
|
||||||
register: result_matrix_synapse_federation_api
|
register: result_matrix_synapse_federation_api
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
when: matrix_synapse_enabled
|
||||||
|
|
||||||
- name: Fail if Matrix Federation API not working
|
- name: Fail if Matrix Federation API not working
|
||||||
fail:
|
fail:
|
||||||
msg: "Failed checking Matrix Federation API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`). Is Synapse running? Is port 8448 open in your firewall? Full error: {{ result_matrix_synapse_federation_api }}"
|
msg: "Failed checking Matrix Federation API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`). Is Synapse running? Is port 8448 open in your firewall? Full error: {{ result_matrix_synapse_federation_api }}"
|
||||||
when: "matrix_synapse_federation_enabled and (result_matrix_synapse_federation_api.failed or 'json' not in result_matrix_synapse_federation_api)"
|
when: "matrix_synapse_enabled and matrix_synapse_federation_enabled and (result_matrix_synapse_federation_api.failed or 'json' not in result_matrix_synapse_federation_api)"
|
||||||
|
|
||||||
- name: Fail if Matrix Federation API unexpectedly enabled
|
- name: Fail if Matrix Federation API unexpectedly enabled
|
||||||
fail:
|
fail:
|
||||||
msg: "Matrix Federation API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`) despite being disabled."
|
msg: "Matrix Federation API is up at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`) despite being disabled."
|
||||||
when: "matrix_synapse_federation_enabled == false and not result_matrix_synapse_federation_api.failed"
|
when: "matrix_synapse_enabled and not matrix_synapse_federation_enabled and not result_matrix_synapse_federation_api.failed"
|
||||||
|
|
||||||
- name: Report working Matrix Federation API
|
- name: Report working Matrix Federation API
|
||||||
debug:
|
debug:
|
||||||
msg: "The Matrix Federation API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`) is working"
|
msg: "The Matrix Federation API at `{{ matrix_server_fqn_matrix }}` (checked endpoint: `{{ matrix_synapse_federation_api_url_endpoint_public }}`) is working"
|
||||||
when: "matrix_synapse_federation_enabled"
|
when: "matrix_synapse_enabled and matrix_synapse_federation_enabled"
|
||||||
|
|
|
@ -15,6 +15,13 @@
|
||||||
- "{{ matrix_synapse_config_dir_path }}"
|
- "{{ matrix_synapse_config_dir_path }}"
|
||||||
- "{{ matrix_synapse_run_path }}"
|
- "{{ matrix_synapse_run_path }}"
|
||||||
- "{{ matrix_synapse_ext_path }}"
|
- "{{ matrix_synapse_ext_path }}"
|
||||||
# We handle matrix_synapse_media_store_path elsewhere (in setup_synapse_main.yml),
|
# We handle matrix_synapse_media_store_path elsewhere (in ./synapse/setup_install.yml),
|
||||||
# because if it's using Goofys and it's already mounted (from before),
|
# because if it's using Goofys and it's already mounted (from before),
|
||||||
# trying to chown/chmod it here will cause trouble.
|
# trying to chown/chmod it here will cause trouble.
|
||||||
|
when: "matrix_synapse_enabled or matrix_s3_media_store_enabled"
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/ext/setup.yml"
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/synapse/setup.yml"
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/goofys/setup.yml"
|
|
@ -1,9 +0,0 @@
|
||||||
---
|
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/setup_synapse_pre.yml"
|
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/ext/setup.yml"
|
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/setup_synapse_main.yml"
|
|
||||||
|
|
||||||
- import_tasks: "{{ role_path }}/tasks/setup_synapse_goofys.yml"
|
|
|
@ -1,87 +0,0 @@
|
||||||
#
|
|
||||||
# Tasks related to setting up Goofys
|
|
||||||
#
|
|
||||||
|
|
||||||
- name: Ensure Goofys Docker image is pulled
|
|
||||||
docker_image:
|
|
||||||
name: "{{ matrix_s3_goofys_docker_image }}"
|
|
||||||
when: matrix_s3_media_store_enabled
|
|
||||||
|
|
||||||
# This will throw a Permission Denied error if already mounted
|
|
||||||
- name: Check Matrix Goofys external storage mountpoint path
|
|
||||||
stat:
|
|
||||||
path: "{{ matrix_synapse_media_store_path }}"
|
|
||||||
register: local_path_matrix_synapse_media_store_path_stat
|
|
||||||
ignore_errors: yes
|
|
||||||
when: matrix_s3_media_store_enabled
|
|
||||||
|
|
||||||
- name: Ensure Matrix Goofys external storage mountpoint exists
|
|
||||||
file:
|
|
||||||
path: "{{ matrix_synapse_media_store_path }}"
|
|
||||||
state: directory
|
|
||||||
mode: 0750
|
|
||||||
owner: "{{ matrix_user_uid }}"
|
|
||||||
group: "{{ matrix_user_gid }}"
|
|
||||||
when: "matrix_s3_media_store_enabled and not local_path_matrix_synapse_media_store_path_stat.failed and not local_path_matrix_synapse_media_store_path_stat.stat.exists"
|
|
||||||
|
|
||||||
- name: Ensure goofys environment variables file created
|
|
||||||
template:
|
|
||||||
src: "{{ role_path }}/templates/goofys/env-goofys.j2"
|
|
||||||
dest: "{{ matrix_synapse_config_dir_path }}/env-goofys"
|
|
||||||
owner: root
|
|
||||||
mode: 0600
|
|
||||||
when: matrix_s3_media_store_enabled
|
|
||||||
|
|
||||||
- name: Ensure matrix-goofys.service installed
|
|
||||||
template:
|
|
||||||
src: "{{ role_path }}/templates/goofys/systemd/matrix-goofys.service.j2"
|
|
||||||
dest: "/etc/systemd/system/matrix-goofys.service"
|
|
||||||
mode: 0644
|
|
||||||
register: matrix_goofys_systemd_service_result
|
|
||||||
when: matrix_s3_media_store_enabled
|
|
||||||
|
|
||||||
- name: Ensure systemd reloaded after matrix-goofys.service installation
|
|
||||||
service:
|
|
||||||
daemon_reload: yes
|
|
||||||
when: "matrix_s3_media_store_enabled and matrix_goofys_systemd_service_result.changed"
|
|
||||||
|
|
||||||
#
|
|
||||||
# Tasks related to getting rid of goofys (if it was previously enabled)
|
|
||||||
#
|
|
||||||
|
|
||||||
- name: Check existence of matrix-goofys service
|
|
||||||
stat:
|
|
||||||
path: "/etc/systemd/system/matrix-goofys.service"
|
|
||||||
register: matrix_goofys_service_stat
|
|
||||||
when: "not matrix_s3_media_store_enabled"
|
|
||||||
|
|
||||||
- name: Ensure matrix-goofys is stopped
|
|
||||||
service:
|
|
||||||
name: matrix-goofys
|
|
||||||
state: stopped
|
|
||||||
daemon_reload: yes
|
|
||||||
register: stopping_result
|
|
||||||
when: "not matrix_s3_media_store_enabled and matrix_goofys_service_stat.stat.exists"
|
|
||||||
|
|
||||||
- name: Ensure matrix-goofys.service doesn't exist
|
|
||||||
file:
|
|
||||||
path: "/etc/systemd/system/matrix-goofys.service"
|
|
||||||
state: absent
|
|
||||||
when: "not matrix_s3_media_store_enabled and matrix_goofys_service_stat.stat.exists"
|
|
||||||
|
|
||||||
- name: Ensure systemd reloaded after matrix-goofys.service removal
|
|
||||||
service:
|
|
||||||
daemon_reload: yes
|
|
||||||
when: "not matrix_s3_media_store_enabled and matrix_goofys_service_stat.stat.exists"
|
|
||||||
|
|
||||||
- name: Ensure goofys environment variables file doesn't exist
|
|
||||||
file:
|
|
||||||
path: "{{ matrix_synapse_config_dir_path }}/env-goofys"
|
|
||||||
state: absent
|
|
||||||
when: "not matrix_s3_media_store_enabled"
|
|
||||||
|
|
||||||
- name: Ensure Goofys Docker image doesn't exist
|
|
||||||
docker_image:
|
|
||||||
name: "{{ matrix_s3_goofys_docker_image }}"
|
|
||||||
state: absent
|
|
||||||
when: "not matrix_s3_media_store_enabled"
|
|
7
roles/matrix-synapse/tasks/synapse/setup.yml
Normal file
7
roles/matrix-synapse/tasks/synapse/setup.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/synapse/setup_install.yml"
|
||||||
|
when: matrix_synapse_enabled
|
||||||
|
|
||||||
|
- import_tasks: "{{ role_path }}/tasks/synapse/setup_uninstall.yml"
|
||||||
|
when: "not matrix_synapse_enabled"
|
28
roles/matrix-synapse/tasks/synapse/setup_uninstall.yml
Normal file
28
roles/matrix-synapse/tasks/synapse/setup_uninstall.yml
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
- name: Check existence of matrix-synapse service
|
||||||
|
stat:
|
||||||
|
path: "/etc/systemd/system/matrix-synapse.service"
|
||||||
|
register: matrix_synapse_service_stat
|
||||||
|
|
||||||
|
- name: Ensure matrix-synapse is stopped
|
||||||
|
service:
|
||||||
|
name: matrix-synapse
|
||||||
|
state: stopped
|
||||||
|
daemon_reload: yes
|
||||||
|
register: stopping_result
|
||||||
|
when: "matrix_synapse_service_stat.stat.exists"
|
||||||
|
|
||||||
|
- name: Ensure matrix-synapse.service doesn't exist
|
||||||
|
file:
|
||||||
|
path: "/etc/systemd/system/matrix-synapse.service"
|
||||||
|
state: absent
|
||||||
|
when: "matrix_synapse_service_stat.stat.exists"
|
||||||
|
|
||||||
|
- name: Ensure systemd reloaded after matrix-synapse.service removal
|
||||||
|
service:
|
||||||
|
daemon_reload: yes
|
||||||
|
when: "matrix_synapse_service_stat.stat.exists"
|
||||||
|
|
||||||
|
- name: Ensure Synapse Docker image doesn't exist
|
||||||
|
docker_image:
|
||||||
|
name: "{{ matrix_synapse_docker_image }}"
|
||||||
|
state: absent
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
- name: Fail if required Synapse settings not defined
|
- name: Fail if required Synapse settings not defined
|
||||||
fail:
|
fail:
|
||||||
msg: >
|
msg: >-
|
||||||
You need to define a required configuration setting (`{{ item }}`) for using Synapse.
|
You need to define a required configuration setting (`{{ item }}`) for using Synapse.
|
||||||
when: "vars[item] == ''"
|
when: "vars[item] == ''"
|
||||||
with_items:
|
with_items:
|
||||||
|
|
|
@ -4,3 +4,6 @@ matrix_synapse_id_servers_public: ['vector.im', 'matrix.org']
|
||||||
|
|
||||||
matrix_synapse_client_api_url_endpoint_public: "https://{{ matrix_server_fqn_matrix }}/_matrix/client/versions"
|
matrix_synapse_client_api_url_endpoint_public: "https://{{ matrix_server_fqn_matrix }}/_matrix/client/versions"
|
||||||
matrix_synapse_federation_api_url_endpoint_public: "https://{{ matrix_server_fqn_matrix }}:8448/_matrix/federation/v1/version"
|
matrix_synapse_federation_api_url_endpoint_public: "https://{{ matrix_server_fqn_matrix }}:8448/_matrix/federation/v1/version"
|
||||||
|
|
||||||
|
# Tells whether this role had executed or not. Toggled to `true` during runtime.
|
||||||
|
matrix_synapse_role_executed: false
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
- matrix-mailer
|
- matrix-mailer
|
||||||
- matrix-postgres
|
- matrix-postgres
|
||||||
- matrix-corporal
|
- matrix-corporal
|
||||||
|
- matrix-bridge-appservice-discord
|
||||||
|
- matrix-bridge-appservice-irc
|
||||||
|
- matrix-bridge-mautrix-facebook
|
||||||
|
- matrix-bridge-mautrix-telegram
|
||||||
|
- matrix-bridge-mautrix-whatsapp
|
||||||
- matrix-synapse
|
- matrix-synapse
|
||||||
- matrix-riot-web
|
- matrix-riot-web
|
||||||
- matrix-mxisd
|
- matrix-mxisd
|
||||||
|
|
Loading…
Reference in a new issue