commit
04f224e634
@ -0,0 +1,13 @@
|
||||
---
|
||||
|
||||
use_default_rules: true
|
||||
|
||||
skip_list:
|
||||
- unnamed-task
|
||||
- no-handler
|
||||
- no-jinja-nesting
|
||||
- schema
|
||||
- command-instead-of-shell
|
||||
- role-name
|
||||
|
||||
offline: false
|
@ -0,0 +1,7 @@
|
||||
.PHONY: lint
|
||||
|
||||
help: ## Show this help.
|
||||
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
|
||||
|
||||
lint: ## Runs ansible-lint against all roles in the playbook
|
||||
ansible-lint
|
After Width: | Height: | Size: 205 KiB |
@ -0,0 +1,75 @@
|
||||
# Setting up Buscarron (optional)
|
||||
|
||||
The playbook can install and configure [buscarron](https://gitlab.com/etke.cc/buscarron) for you.
|
||||
|
||||
It's a bot you can use to setup **your own helpdesk on matrix**
|
||||
It's a bot you can use to send any form (HTTP POST, HTML) to a (encrypted) matrix room
|
||||
|
||||
## Registering the bot user
|
||||
|
||||
By default, the playbook will set up the bot with a username like this: `@bot.buscarron:DOMAIN`.
|
||||
|
||||
(to use a different username, adjust the `matrix_bot_buscarron_login` variable).
|
||||
|
||||
You **need to register the bot user manually** before setting up the bot. You can use the playbook to [register a new user](registering-users.md):
|
||||
|
||||
```
|
||||
ansible-playbook -i inventory/hosts setup.yml --extra-vars='username=bot.buscarron password=PASSWORD_FOR_THE_BOT admin=no' --tags=register-user
|
||||
```
|
||||
|
||||
Choose a strong password for the bot. You can generate a good password with a command like this: `pwgen -s 64 1`.
|
||||
|
||||
|
||||
## Adjusting the playbook configuration
|
||||
|
||||
Add the following configuration to your `inventory/host_vars/matrix.DOMAIN/vars.yml` file:
|
||||
|
||||
```yaml
|
||||
matrix_bot_buscarron_enabled: true
|
||||
|
||||
# Adjust this to whatever password you chose when registering the bot user
|
||||
matrix_bot_buscarron_password: PASSWORD_FOR_THE_BOT
|
||||
|
||||
# Adjust accepted forms
|
||||
matrix_bot_buscarron_forms:
|
||||
- name: contact # (mandatory) Your form name, will be used as endpoint, eg: buscarron.DOMAIN/contact
|
||||
room: "!yourRoomID:DOMAIN" # (mandatory) Room ID where form submission will be posted
|
||||
redirect: https://DOMAIN # (mandatory) To what page user will be redirected after the form submission
|
||||
ratelimit: 1r/m # (optional) rate limit of the form, format: <max requests>r/<interval:s,m>, eg: 1r/s or 54r/m
|
||||
extensions: [] # (optional) list of form extensions (not used yet)
|
||||
|
||||
matrix_bot_buscarron_spam_hosts: [] # (optional) list of email domains/hosts that should be rejected automatically
|
||||
matrix_bot_buscarron_spam_emails: [] # (optional) list of email addresses that should be rejected automatically
|
||||
```
|
||||
|
||||
You will also need to add a DNS record so that buscarron can be accessed.
|
||||
By default buscarron will use https://buscarron.DOMAIN so you will need to create an CNAME record for `buscarron`.
|
||||
See [Configuring DNS](configuring-dns.md).
|
||||
|
||||
If you would like to use a different domain, add the following to your configuration file (changing it to use your preferred domain):
|
||||
|
||||
```yaml
|
||||
matrix_server_fqn_buscarron: "form.{{ matrix_domain }}"
|
||||
```
|
||||
|
||||
|
||||
## Installing
|
||||
|
||||
After configuring the playbook, run the [installation](installing.md) command again:
|
||||
|
||||
```
|
||||
ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
To use the bot, invite the `@bot.buscarron:DOMAIN` to the room you specified in a config, after that any point your form to the form url, example for the `contact` form:
|
||||
|
||||
```html
|
||||
<form method="POST" action="https://buscarron.DOMAIN/contact">
|
||||
<!--your fields-->
|
||||
</form>
|
||||
```
|
||||
|
||||
You can also refer to the upstream [documentation](https://gitlab.com/etke.cc/buscarron).
|
@ -0,0 +1,72 @@
|
||||
# Setting up matrix-registration-bot (optional)
|
||||
|
||||
The playbook can install and configure [matrix-registration-bot](https://github.com/moan0s/matrix-registration-bot) for you.
|
||||
|
||||
The bot allows you to easily **create and manage registration tokens**. It can be used for an invitation-based server,
|
||||
where you invite someone by sending them a registration token. They can register as normal but have to provide a valid
|
||||
registration token in a final step of the registration.
|
||||
|
||||
See the project's [documentation](https://github.com/moan0s/matrix-registration-bot#supported-commands) to learn what it
|
||||
does and why it might be useful to you.
|
||||
|
||||
|
||||
## Registering the bot user
|
||||
|
||||
By default, the playbook will set use the bot with a username like this: `@bot.matrix-registration-bot:DOMAIN`.
|
||||
|
||||
(to use a different username, adjust the `matrix_bot_matrix_registration_bot_matrix_user_id_localpart` variable).
|
||||
|
||||
You **need to register the bot user manually** before setting up the bot. You can use the playbook to [register a new user](registering-users.md):
|
||||
|
||||
```
|
||||
ansible-playbook -i inventory/hosts setup.yml --extra-vars='username=bot.matrix-registration-bot password=PASSWORD_FOR_THE_BOT admin=yes' --tags=register-user
|
||||
```
|
||||
|
||||
Choose a strong password for the bot. You can generate a good password with a command like this: `pwgen -s 64 1`.
|
||||
|
||||
## Obtaining an admin access token
|
||||
|
||||
In order to use the bot you need to add an admin user's access token token to the configuration. As you created an admin user for the
|
||||
bot, it is recommended to obtain an access token by logging into Element/Schildichat with the bot account
|
||||
(using the password you set) and navigate to `Settings->Help&About` and scroll to the bottom.
|
||||
You can expand "Access token" to copy it.
|
||||
|
||||
![Obatining an admin access token with Element](assets/obtain_admin_access_token_element.png)
|
||||
|
||||
**IMPORTANT**: once you copy the token, just close the Matrix client window/tab. Do not "log out", as that would invalidate the token.
|
||||
|
||||
## Adjusting the playbook configuration
|
||||
|
||||
Add the following configuration to your `inventory/host_vars/matrix.DOMAIN/vars.yml` file:
|
||||
|
||||
```yaml
|
||||
matrix_bot_matrix_registration_bot_enabled: true
|
||||
# Token obtained via logging into the bot account (see above)
|
||||
matrix_bot_matrix_registration_bot_bot_access_token: "syt_bW9hbm9z_XXXXXXXXXXXXXr_2kuzbE"
|
||||
|
||||
# Enables registration
|
||||
matrix_synapse_enable_registration: true
|
||||
|
||||
# Restrict registration to users with a token
|
||||
matrix_synapse_registration_requires_token: true
|
||||
```
|
||||
|
||||
|
||||
## Installing
|
||||
|
||||
After configuring the playbook, run the [installation](installing.md) command again:
|
||||
|
||||
```
|
||||
ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
To use the bot, create a **non-encrypted** room and invite `@bot.matrix-registration-bot:DOMAIN` (where `YOUR_DOMAIN` is your base domain, not the `matrix.` domain).
|
||||
|
||||
In this room send `help` and the bot will reply with all options.
|
||||
|
||||
You can also refer to the upstream [Usage documentation](https://github.com/moan0s/matrix-registration-bot#supported-commands).
|
||||
If you have any questions, or if you need help setting it up, read the [troublshooting guide](https://github.com/moan0s/matrix-registration-bot/blob/main/docs/troubleshooting.md)
|
||||
or join [#matrix-registration-bot:hyteck.de](https://matrix.to/#/#matrix-registration-bot:hyteck.de).
|
@ -0,0 +1,63 @@
|
||||
# Setting up maubot (optional)
|
||||
|
||||
The playbook can install and configure [maubot](https://github.com/maubot/maubot) for you.
|
||||
|
||||
After setting up maubot, you can use the web management interface to make it do things.
|
||||
The default location of the management interface is `matrix.<your-domain>/_matrix/maubot/`
|
||||
|
||||
See the project's [documentation](https://docs.mau.fi/maubot/usage/basic.html) to learn what it
|
||||
does and why it might be useful to you.
|
||||
|
||||
## Adjusting the playbook configuration
|
||||
|
||||
Add the following configuration to your `inventory/host_vars/matrix.DOMAIN/vars.yml` file:
|
||||
|
||||
```yaml
|
||||
matrix_bot_maubot_enabled: true
|
||||
matrix_bot_maubot_admins:
|
||||
- yourusername: securepassword
|
||||
```
|
||||
|
||||
You can add multiple admins. The admin accounts are not connected to any matrix ID and are only used to access the
|
||||
maubot administration interface.
|
||||
|
||||
|
||||
## Installing
|
||||
|
||||
After configuring the playbook, run the [installation](installing.md) command again:
|
||||
|
||||
```
|
||||
ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
You can visit `matrix.<your-domain>/_matrix/maubot/` to manage your available plugins, clients and instances.
|
||||
|
||||
You should start in the following order
|
||||
1. **Create one or more clients:** A client is a matrix account which the bot will use to message.
|
||||
2. **Upload some Plugins:** Plugins can be obtained from [here](https://github.com/maubot/maubot#plugins) or any other source.
|
||||
3. **Create an instance:** An instance is the actual bot. You have to specify a client which the bot instance will use
|
||||
and the plugin (how the bot will behave)
|
||||
|
||||
To add a client you first need to create an account and obtain a valid access token.
|
||||
|
||||
## Registering the bot user
|
||||
|
||||
You **need to register the bot user manually** before setting up the bot. You can use the playbook to [register a new user](registering-users.md):
|
||||
|
||||
```
|
||||
ansible-playbook -i inventory/hosts setup.yml --extra-vars='username=bot.maubot password=PASSWORD_FOR_THE_BOT admin=yes' --tags=register-user
|
||||
```
|
||||
|
||||
Choose a strong password for the bot. You can generate a good password with a command like this: `pwgen -s 64 1`.
|
||||
|
||||
## Obtaining an admin access token
|
||||
|
||||
This can be done via `mbc auth` (see the [maubot documentation](https://docs.mau.fi/maubot/usage/cli/auth.html)) or by logging into Element/Schildichat with the bot account
|
||||
(using the password you set) and navigate to `Settings->Help&About` and scroll to the bottom.
|
||||
You can expand "Access token" to copy it.
|
||||
|
||||
![Obatining an admin access token with Element](assets/obtain_admin_access_token_element.png)
|
||||
|
||||
**IMPORTANT**: once you copy the token, just close the Matrix client window/tab. Do not "log out", as that would invalidate the token.
|
@ -0,0 +1,68 @@
|
||||
# Setting up Appservice Kakaotalk (optional)
|
||||
|
||||
The playbook can install and configure [matrix-appservice-kakaotalk](https://src.miscworks.net/fair/matrix-appservice-kakaotalk) for you. `matrix-appservice-kakaotalk` is a bridge to [Kakaotalk](https://www.kakaocorp.com/page/service/service/KakaoTalk?lang=ENG) based on [node-kakao](https://github.com/storycraft/node-kakao) (now unmaintained) and some [mautrix-facebook](https://github.com/mautrix/facebook) code.
|
||||
|
||||
See the project's [documentation](https://src.miscworks.net/fair/matrix-appservice-kakaotalk) to learn what it does and why it might be useful to you.
|
||||
|
||||
|
||||
## Installing
|
||||
|
||||
To enable the bridge, add this to your `vars.yml` file:
|
||||
|
||||
```yaml
|
||||
matrix_appservice_kakaotalk_enabled: true
|
||||
```
|
||||
|
||||
You may optionally wish to add some [Additional configuration](#additional-configuration), or to [prepare for double-puppeting](#set-up-double-puppeting) before the initial installation.
|
||||
|
||||
After adjusting your `vars.yml` file, re-run the playbook and restart all services: `ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start`
|
||||
|
||||
To make use of the Kakaotalk bridge, see [Usage](#usage) below.
|
||||
|
||||
|
||||
### Additional configuration
|
||||
|
||||
There are some additional things you may wish to configure about the bridge.
|
||||
|
||||
Take a look at:
|
||||
|
||||
- `roles/matrix-bridge-appservice-kakaotalk/defaults/main.yml` for some variables that you can customize via your `vars.yml` file
|
||||
- `roles/matrix-bridge-appservice-kakaotalk/templates/config.yaml.j2` for the bridge's default configuration. You can override settings (even those that don't have dedicated playbook variables) using the `matrix_appservice_kakaotalk_configuration_extension_yaml` variable
|
||||
|
||||
|
||||
### Set up Double Puppeting
|
||||
|
||||
If you'd like to use [Double Puppeting](https://docs.mau.fi/bridges/general/double-puppeting.html) (hint: you most likely do), you have 2 ways of going about it.
|
||||
|
||||
#### Method 1: automatically, by enabling Shared Secret Auth
|
||||
|
||||
The bridge will automatically perform Double Puppeting if you enable [Shared Secret Auth](configuring-playbook-shared-secret-auth.md) for this playbook.
|
||||
|
||||
This is the recommended way of setting up Double Puppeting, as it's easier to accomplish, works for all your users automatically, and has less of a chance of breaking in the future.
|
||||
|
||||
#### Method 2: manually, by asking each user to provide a working access token
|
||||
|
||||
**Note**: This method for enabling Double Puppeting can be configured only after you've already set up bridging (see [Usage](#usage)).
|
||||
|
||||
When using this method, **each user** that wishes to enable Double Puppeting needs to follow the following steps:
|
||||
|
||||
- retrieve a Matrix access token for yourself. You can use the following command:
|
||||
|
||||
```
|
||||
curl \
|
||||
--data '{"identifier": {"type": "m.id.user", "user": "YOUR_MATRIX_USERNAME" }, "password": "YOUR_MATRIX_PASSWORD", "type": "m.login.password", "device_id": "Appservice-Kakaotalk", "initial_device_display_name": "Appservice-Kakaotalk"}' \
|
||||
https://matrix.DOMAIN/_matrix/client/r0/login
|
||||
```
|
||||
|
||||
- send the access token to the bot. Example: `login-matrix MATRIX_ACCESS_TOKEN_HERE`
|
||||
|
||||
- make sure you don't log out the `Appservice-Kakaotalk` device some time in the future, as that would break the Double Puppeting feature
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Start a chat with `@kakaotalkbot:YOUR_DOMAIN` (where `YOUR_DOMAIN` is your base domain, not the `matrix.` domain).
|
||||
|
||||
Send `login --save EMAIL_OR_PHONE_NUMBER` to the bridge bot to enable bridging for your Kakaotalk account. The `--save` flag may be omitted, if you'd rather not save your password.
|
||||
|
||||
After successfully enabling bridging, you may wish to [set up Double Puppeting](#set-up-double-puppeting), if you haven't already done so.
|
@ -0,0 +1,23 @@
|
||||
# Setting up Go Skype Bridge (optional)
|
||||
|
||||
The playbook can install and configure
|
||||
[go-skype-bridge](https://github.com/kelaresg/go-skype-bridge) for you.
|
||||
|
||||
See the project page to learn what it does and why it might be useful to you.
|
||||
|
||||
To enable the [Skype](https://www.skype.com/) bridge just use the following
|
||||
playbook configuration:
|
||||
|
||||
|
||||
```yaml
|
||||
matrix_go_skype_bridge_enabled: true
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Once the bot is enabled, you need to start a chat with `Skype bridge bot`
|
||||
with the handle `@skypebridgebot:YOUR_DOMAIN` (where `YOUR_DOMAIN` is your base
|
||||
domain, not the `matrix.` domain).
|
||||
|
||||
Send `help` to the bot to see the commands available.
|
@ -0,0 +1,87 @@
|
||||
# Setting up Mautrix Discord (optional)
|
||||
|
||||
**Note**: bridging to [Discord](https://discordapp.com/) can also happen via the [mx-puppet-discord](configuring-playbook-bridge-mx-puppet-discord.md) and [matrix-appservice-discord](configuring-playbook-bridge-appservice-discord.md) bridges supported by the playbook.
|
||||
- For using as a Bot we recommend the [Appservice Discord](configuring-playbook-bridge-appservice-discord.md), because it supports plumbing.
|
||||
- For personal use with a discord account we recommend the `mautrix-discord` bridge (the one being discussed here), because it is the most fully-featured and stable of the 3 Discord bridges supported by the playbook.
|
||||
The `mautrix-discord` bridge (the one being discussed here) is the most fully-featured and stable of the 3 Discord bridges supported by the playbook, so it's the one we recommend.
|
||||
|
||||
The playbook can install and configure [mautrix-discord](https://github.com/mautrix/discord) for you.
|
||||
|
||||
See the project's [documentation](https://docs.mau.fi/bridges/go/discord/index.html) to learn what it does and why it might be useful to you.
|
||||
|
||||
|
||||
## Prerequisites
|
||||
|
||||
For using this bridge, you would **need to authenticate by scanning a QR code with the Discord app on your phone**.
|
||||
|
||||
You can delete the Discord app after the authentication process.
|
||||
|
||||
If this is a dealbreaker for you, consider using one of the other Discord bridges supported by the playbook: [mx-puppet-discord](configuring-playbook-bridge-mx-puppet-discord.md) or [matrix-appservice-discord](configuring-playbook-bridge-appservice-discord.md). These come with their own complexity and limitations, however, so we recommend that you proceed with this one if possible.
|
||||
|
||||
|
||||
## Installing
|
||||
|
||||
To enable the bridge, add this to your `vars.yml` file:
|
||||
|
||||
```yaml
|
||||
matrix_mautrix_discord_enabled: true
|
||||
```
|
||||
|
||||
You may optionally wish to add some [Additional configuration](#additional-configuration), or to [prepare for double-puppeting](#set-up-double-puppeting) before the initial installation.
|
||||
|
||||
After adjusting your `vars.yml` file, re-run the playbook and restart all services: `ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start`
|
||||
|
||||
To make use of the bridge, see [Usage](#usage) below.
|
||||
|
||||
|
||||
### Additional configuration
|
||||
|
||||
There are some additional things you may wish to configure about the bridge.
|
||||
|
||||
Take a look at:
|
||||
|
||||
- `roles/matrix-bridge-mautrix-discord/defaults/main.yml` for some variables that you can customize via your `vars.yml` file
|
||||
- `roles/matrix-bridge-mautrix-discord/templates/config.yaml.j2` for the bridge's default configuration. You can override settings (even those that don't have dedicated playbook variables) using the `matrix_mautrix_discord_configuration_extension_yaml` variable
|
||||
|
||||
|
||||
### Set up Double Puppeting
|
||||
|
||||
If you'd like to use [Double Puppeting](https://docs.mau.fi/bridges/general/double-puppeting.html) (hint: you most likely do), you have 2 ways of going about it.
|
||||
|
||||
#### Method 1: automatically, by enabling Shared Secret Auth
|
||||
|
||||
The bridge will automatically perform Double Puppeting if you enable [Shared Secret Auth](configuring-playbook-shared-secret-auth.md) for this playbook.
|
||||
|
||||
This is the recommended way of setting up Double Puppeting, as it's easier to accomplish, works for all your users automatically, and has less of a chance of breaking in the future.
|
||||
|
||||
#### Method 2: manually, by asking each user to provide a working access token
|
||||
|
||||
**Note**: This method for enabling Double Puppeting can be configured only after you've already set up bridging (see [Usage](#usage)).
|
||||
|
||||
When using this method, **each user** that wishes to enable Double Puppeting needs to follow the following steps:
|
||||
|
||||
- retrieve a Matrix access token for yourself. You can use the following command:
|
||||
|
||||
```
|
||||
curl \
|
||||
--data '{"identifier": {"type": "m.id.user", "user": "YOUR_MATRIX_USERNAME" }, "password": "YOUR_MATRIX_PASSWORD", "type": "m.login.password", "device_id": "Mautrix-Discord", "initial_device_display_name": "Mautrix-Discord"}' \
|
||||
https://matrix.DOMAIN/_matrix/client/r0/login
|
||||
```
|
||||
|
||||
- send the access token to the bot. Example: `login-matrix MATRIX_ACCESS_TOKEN_HERE`
|
||||
|
||||
- make sure you don't log out the `Mautrix-Discord` device some time in the future, as that would break the Double Puppeting feature
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
1. Start a chat with `@discordbot:YOUR_DOMAIN` (where `YOUR_DOMAIN` is your base domain, not the `matrix.` domain).
|
||||
2. Send a `login` command
|
||||
3. You'll see a QR code which you need to scan with the Discord app on your phone. You can scan it with the camera app too, which will open Discord, which will then instruct you to scan it a 2nd time in the Discord app.
|
||||
4. After confirming (in the Discord app) that you'd like to allow this login, the bot should respond with "Succcessfully authenticated as ..."
|
||||
5. Now that you're logged in, you can send a `help` command to the bot again, to see additional commands you have access to
|
||||
6. Some Direct Messages from Discord should start syncing automatically
|
||||
7. If you'd like to bridge guilds:
|
||||
- send `guilds status` to see the list of guilds
|
||||
- for each guild that you'd like bridged, send `guilds bridge GUILD_ID --entire`
|
||||
8. You may wish to uninstall the Discord app from your phone now. It's not needed for the bridge to function.
|
@ -1,30 +1,5 @@
|
||||
# Setting up MX Puppet Skype (optional)
|
||||
|
||||
The playbook can install and configure
|
||||
[mx-puppet-skype](https://github.com/Sorunome/mx-puppet-skype) for you.
|
||||
The playbook used to be able to install and configure [mx-puppet-skype](https://github.com/Sorunome/mx-puppet-skype), but no longer includes this component, because it has been broken and unmaintaned for a long time.
|
||||
|
||||
See the project page to learn what it does and why it might be useful to you.
|
||||
|
||||
To enable the [Skype](https://www.skype.com/) bridge just use the following
|
||||
playbook configuration:
|
||||
|
||||
|
||||
```yaml
|
||||
matrix_mx_puppet_skype_enabled: true
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
Once the bot is enabled you need to start a chat with `Skype Puppet Bridge` with
|
||||
the handle `@_skypepuppet_bot:YOUR_DOMAIN` (where `YOUR_DOMAIN` is your base
|
||||
domain, not the `matrix.` domain).
|
||||
|
||||
Send `link <username> <password>` to the bridge bot to link your skype account.
|
||||
|
||||
Once logged in, send `list` to the bot user to list the available rooms.
|
||||
|
||||
Clicking rooms in the list will result in you receiving an invitation to the
|
||||
bridged room.
|
||||
|
||||
Also send `help` to the bot to see the commands available.
|
||||
Bridging to [Skype](https://www.skype.com/) can also happen via the [go-skype-bridge](configuring-playbook-bridge-go-skype-bridge.md) bridge supported by the playbook.
|
||||
|
@ -0,0 +1,111 @@
|
||||
# Setting up a Generic Mautrix Bridge (optional)
|
||||
|
||||
The playbook can install and configure various [mautrix](https://github.com/mautrix) bridges (twitter, facebook, instagram, signal, hangouts, googlechat, etc.), as well as many other (non-mautrix) bridges.
|
||||
This is a common guide for configuring mautrix bridges.
|
||||
|
||||
You can see each bridge's features at in the `ROADMAP.md` file in its corresponding [mautrix](https://github.com/mautrix) repository.
|
||||
|
||||
To enable a bridge add:
|
||||
|
||||
|
||||
```yaml
|
||||
# Replace SERVICENAME with one of: twitter, facebook, instagram, ..
|
||||
matrix_mautrix_SERVICENAME_enabled: true
|
||||
```
|
||||
|
||||
to your `vars.yml`
|
||||
|
||||
There are some additional things you may wish to configure about the bridge before you continue. Each bridge may have additional requirements besides `_enabled: true`. For example, the mautrix-telegram bridge (our documentation page about it is [here](configuring-playbook-bridge-mautrix-telegram.md)) requires the `matrix_mautrix_telegram_api_id` and `matrix_mautrix_telegram_api_hash` variables to be defined. Refer to each bridge's individual documentation page for details about enabling bridges.
|
||||
|
||||
You can add
|
||||
|
||||
```yaml
|
||||
matrix_admin: "@YOUR_USERNAME:{{ matrix_domain }}"
|
||||
```
|
||||
to `vars.yml` to **configure a user as an administrator for all bridges**.
|
||||
**Alternatively** (more verbose, but allows multiple admins to be configured), you can do the same on a per-bridge basis with:
|
||||
|
||||
```yaml
|
||||
matrix_mautrix_SERVICENAME_configuration_extension_yaml: |
|
||||
bridge:
|
||||
permissions:
|
||||
'@YOUR_USERNAME:{{ matrix_domain }}': admin
|
||||
```
|
||||
|
||||
Encryption support is off by default. If you would like to enable encryption, add the following to your `vars.yml` file:
|
||||
```yaml
|
||||
matrix_mautrix_SERVICENAME_configuration_extension_yaml: |
|
||||
bridge:
|
||||
encryption:
|
||||
allow: true
|
||||
default: true
|
||||
```
|
||||
|
||||
|
||||
You can only have one `matrix_mautrix_SERVICENAME_configuration_extension_yaml` definition in `vars.yml` per bridge, so if you need multiple pieces of configuration there, just merge them like this:
|
||||
|
||||
```yaml
|
||||
matrix_mautrix_SERVICENAME_configuration_extension_yaml: |
|
||||
bridge:
|
||||
permissions:
|
||||
'@YOUR_USERNAME:{{ matrix_domain }}': admin
|
||||
encryption:
|
||||
allow: true
|
||||
default: true
|
||||
```
|
||||
|
||||
## Setting the bot's username
|
||||
|
||||
```yaml
|
||||
matrix_mautrix_SERVICENAME_appservice_bot_username: "BOTNAME"
|
||||
```
|
||||
|
||||
Can be used to set the username for the bridge.
|
||||
|
||||
## Discovering additional configuration options
|
||||
|
||||
You may wish to look at `roles/matrix-bridge-mautrix-SERVICENAME/templates/config.yaml.j2` and `roles/matrix-bridge-mautrix-SERVICENAME/defaults/main.yml` to find other things you would like to configure.
|
||||
|
||||
|
||||
## Set up Double Puppeting
|
||||
|
||||
To set up [Double Puppeting](https://docs.mau.fi/bridges/general/double-puppeting.html)
|
||||
|
||||
please do so automatically, by enabling Shared Secret Auth
|
||||
|
||||
The bridge will automatically perform Double Puppeting if you enable [Shared Secret Auth](configuring-playbook-shared-secret-auth.md) for this playbook by adding
|
||||
|
||||
```yaml
|
||||
matrix_synapse_ext_password_provider_shared_secret_auth_enabled: true
|
||||
matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret: YOUR_SHARED_SECRET_GOES_HERE
|
||||
```
|
||||
|
||||
You should generate a strong shared secret with a command like this: pwgen -s 64 1
|
||||
|
||||
This is the recommended way of setting up Double Puppeting, as it's easier to accomplish, works for all your users automatically, and has less of a chance of breaking in the future.
|
||||
|
||||
## Controlling the logging level
|
||||
|
||||
```yaml
|
||||
matrix_mautrix_SERVICENAME_logging_level: WARN
|
||||
```
|
||||
|
||||
to `vars.yml` to control the logging level, where you may replace WARN with one of the following to control the verbosity of the logs generated: TRACE, DEBUG, INFO, WARN, ERROR, or FATAL.
|
||||
|
||||
If you have issues with a service, and are requesting support, the higher levels of logging will generally be more helpful.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
You then need to start a chat with `@SERVICENAMEbot:YOUR_DOMAIN` (where `YOUR_DOMAIN` is your base domain, not the `matrix.` domain).
|
||||
|
||||
Send `login ` to the bridge bot to get started You can learn more here about authentication from the bridge's official documentation on Authentication https://docs.mau.fi/bridges/python/SERVICENAME/authentication.html .
|
||||
|
||||
If you run into trouble, check the [Troubleshooting](#troubleshooting) section below.
|
||||
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
For troubleshooting information with a specific bridge, please see the playbook documentation about it (some other document in in `docs/`) and the upstream ([mautrix](https://github.com/mautrix)) bridge documentation for that specific bridge.
|
||||
Reporting bridge bugs should happen upstream, in the corresponding mautrix repository, not to us.
|
@ -0,0 +1,93 @@
|
||||
# Setting up ntfy (optional)
|
||||
|
||||
The playbook can install and configure the [ntfy](https://ntfy.sh/) push notifications server for you.
|
||||
|
||||
Using the [UnifiedPush](https://unifiedpush.org) standard, ntfy enables self-hosted (Google-free) push notifications from Matrix (and other) servers to UnifiedPush-compatible matrix compatible client apps running on Android and other devices.
|
||||
|
||||
This role is intended to support UnifiedPush notifications for use with the Matrix and Matrix-related services that this playbook installs. This role is not intended to support all of ntfy's other features.
|
||||
|
||||
**Note**: In contrast to push notifications using Google's FCM or Apple's APNs, the use of UnifiedPush allows each end-user to choose the push notification server that they prefer. As a consequence, deploying this ntfy server does not by itself ensure any particular user or device or client app will use it.
|
||||
|
||||
|
||||
## Adjusting the playbook configuration
|
||||
|
||||
Add the following configuration to your `inventory/host_vars/matrix.DOMAIN/vars.yml` file (adapt to your needs):
|
||||
|
||||
```yaml
|
||||
# Enabling it is the only required setting
|
||||
matrix_ntfy_enabled: true
|
||||
|
||||
# Some other options
|
||||
matrix_server_fqn_ntfy: "ntfy.{{ matrix_domain }}"
|
||||
matrix_ntfy_configuration_extension_yaml: |
|
||||
log_level: DEBUG
|
||||
```
|
||||
|
||||
For a more complete list of variables that you could override, see `roles/matrix-ntfy/defaults/main.yml`.
|
||||
|
||||
For a complete list of ntfy config options that you could put in `matrix_ntfy_configuration_extension_yaml`, see the [ntfy config documentation](https://ntfy.sh/docs/config/#config-options).
|
||||
|
||||
|
||||
## Installing
|
||||
|
||||
Don't forget to add `ntfy.<your-domain>` to DNS as described in [Configuring DNS](configuring-dns.md) before running the playbook.
|
||||
|
||||
After configuring the playbook, run the [installation](installing.md) command again:
|
||||
|
||||
```
|
||||
ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
To make use of your ntfy installation, on Android for example, you need two things:
|
||||
|
||||
* the `ntfy` app
|
||||
* a UnifiedPush-compatible matrix app
|
||||
|
||||
You need to install the `ntfy` app on each device on which you want to receive push notifications through your ntfy server. The `ntfy` app will provide UnifiedPush notifications to any number of UnifiedPush-compatible messaging apps installed on the same device.
|
||||
|
||||
### Setting up the `ntfy` Android app
|
||||
|
||||
1. Install the [ntfy Android app](https://ntfy.sh/docs/subscribe/phone/) from F-droid or Google Play.
|
||||
2. In its Settings -> `General: Default server`, enter your ntfy server URL, such as `https://ntfy.DOMAIN`.
|
||||
3. In its Settings -> `Advanced: Connection protocol`, choose `WebSockets`.
|
||||
|
||||
That is all you need to do in the ntfy app. It has many other features, but for our purposes you can ignore them. In particular you do not need to follow any instructions about subscribing to a notification topic as UnifiedPush will do that automatically.
|
||||
|
||||
### Setting up a UnifiedPush-compatible matrix app
|
||||
|
||||
Install any UnifiedPush-enabled matrix app on that same device. The matrix app will learn from the `ntfy` app that you have configured UnifiedPush on this device, and then it will tell your matrix server to use it.
|
||||
|
||||
Steps needed for specific matrix apps:
|
||||
|
||||
* FluffyChat-android:
|
||||
- Should auto-detect and use it. No manual settings.
|
||||
|
||||
* SchildiChat-android:
|
||||
1. enable `Settings` -> `Notifications` -> `UnifiedPush: Force custom push gateway`.
|
||||
2. choose `Settings` -> `Notifications` -> `UnifiedPush: Re-register push distributor`. *(For info, a more complex alternative to achieve the same is: delete the relevant unifiedpush registration in `ntfy` app, force-close SchildiChat, re-open it.)*
|
||||
3. verify `Settings` -> `Notifications` -> `UnifiedPush: Notification targets` as described below in the "Troubleshooting" section.
|
||||
|
||||
* Element-android v1.4.26+:
|
||||
- [not yet documented; should auto-detect and use it?]
|
||||
|
||||
If the matrix app asks, "Choose a distributor: FCM Fallback or ntfy", then choose "ntfy".
|
||||
|
||||
If the matrix app doesn't seem to pick it up, try restarting it and try the Troubleshooting section below.
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
First check that the matrix client app you are using supports UnifiedPush. There may well be different variants of the app.
|
||||
|
||||
Set the ntfy server's log level to 'DEBUG', as shown in the example settings above, and watch the server's logs with `sudo journalctl -fu matrix-ntfy`.
|
||||
|
||||
To check if UnifiedPush is correctly configured on the client device, look at "Settings -> Notifications -> Notification Targets" in Element-Android or SchildiChat, or "Settings -> Notifications -> Devices" in FluffyChat. There should be one entry for each matrix client app that has enabled push notifications, and when that client is using UnifiedPush you should see a URL that begins with your ntfy server's URL.
|
||||
|
||||
In the "Notification Targets" screen in Element-Android or SchildiChat, two relevant URLs are shown, "push\_key" and "Url", and both should begin with your ntfy server's URL. If "push\_key" shows your server but "Url" shows an external server such as `up.schildi.chat` then push notifications will still work but are being routed through that external server before they reach your ntfy server. To rectify that, in SchildiChat (at least around version 1.4.20.sc55) you must enable the `Force custom push gateway` setting as described in the "Usage" section above.
|
||||
|
||||
If it is not working, useful tools are "Settings -> Notifications -> Re-register push distributor" and "Settings -> Notifications -> Troubleshoot Notifications" in SchildiChat (possibly also Element-Android). In particular the "Endpoint/FCM" step of that troubleshooter should display your ntfy server's URL that it has discovered from the ntfy client app.
|
||||
|
||||
The simple [UnifiedPush troubleshooting](https://unifiedpush.org/users/troubleshooting/) app [UP-Example](https://f-droid.org/en/packages/org.unifiedpush.example/) can be used to manually test UnifiedPush registration and operation on an Android device.
|
@ -0,0 +1,11 @@
|
||||
---
|
||||
|
||||
# This is a host file for usage with the `ansible-all-hosts.sh` script,
|
||||
# which runs Ansible against a bunch of hosts, each with its own `sudo` password.
|
||||
matrix_servers:
|
||||
hosts:
|
||||
matrix.<your domain>:
|
||||
ansible_host: <your server's external ip address>
|
||||
ansible_ssh_user: <your ssh user>
|
||||
become: true
|
||||
become_user: root
|
@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Run the playbook on multiple hosts with different credentials with this script
|
||||
# It defaults to ansible tags "setup-all,start". You can pass alternative tags
|
||||
# to this script as arguments, e.g.
|
||||
#
|
||||
# ./inventory/scripts/ansible-all-hosts.sh self-check
|
||||
#
|
||||
|
||||
# set playbook root path
|
||||
root=$(dirname "$(readlink -f "$0")")/../..
|
||||
|
||||
# set default tags or get from first argument if any
|
||||
tags="${1:-setup-all,start}"
|
||||
|
||||
# init password array
|
||||
declare -A pws
|
||||
|
||||
# capture passwords for all hosts
|
||||
for host in "$root"/inventory/*.yml; do
|
||||
read -rp "sudo password for $(basename "$host"): " -s pw
|
||||
pws[$host]="$pw"
|
||||
echo
|
||||
done
|
||||
|
||||
# run ansible on all captured passwords/hosts
|
||||
for host in "${!pws[@]}"; do
|
||||
ansible-playbook "$root"/setup.yml \
|
||||
--inventory-file "$host" \
|
||||
--extra-vars "ansible_become_pass=${pws[$host]}" \
|
||||
--tags="$tags"
|
||||
done
|
@ -1,4 +1,4 @@
|
||||
---
|
||||
- set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-backup-borg.service', 'matrix-backup-borg.timer'] }}"
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-backup-borg.timer'] }}"
|
||||
when: matrix_backup_borg_enabled | bool
|
||||
|
@ -1,23 +1,23 @@
|
||||
---
|
||||
# This is for both RedHat 7 and 8
|
||||
- name: Ensure fuse installed (RedHat)
|
||||
yum:
|
||||
ansible.builtin.yum:
|
||||
name:
|
||||
- fuse
|
||||
state: latest
|
||||
state: present
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
# This is for both Debian and Raspbian
|
||||
- name: Ensure fuse installed (Debian/Raspbian)
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- fuse
|
||||
state: latest
|
||||
state: present
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Ensure fuse installed (Archlinux)
|
||||
pacman:
|
||||
name:
|
||||
- fuse3
|
||||
state: latest
|
||||
state: present
|
||||
when: ansible_distribution == 'Archlinux'
|
||||
|
@ -1,23 +1,23 @@
|
||||
---
|
||||
# This is for both RedHat 7 and 8
|
||||
- name: Ensure openssl installed (RedHat)
|
||||
yum:
|
||||
ansible.builtin.yum:
|
||||
name:
|
||||
- openssl
|
||||
state: latest
|
||||
state: present
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
# This is for both Debian and Raspbian
|
||||
- name: Ensure openssl installed (Debian/Raspbian)
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- openssl
|
||||
state: latest
|
||||
state: present
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Ensure openssl installed (Archlinux)
|
||||
pacman:
|
||||
name:
|
||||
- openssl
|
||||
state: latest
|
||||
state: present
|
||||
when: ansible_distribution == 'Archlinux'
|
||||
|
@ -0,0 +1,7 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
{
|
||||
"admins": {{ matrix_homeserver_admin_contacts|to_json }}
|
||||
{% if matrix_homeserver_support_url %},
|
||||
"support_page": {{ matrix_homeserver_support_url|to_json }}
|
||||
{% endif %}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
---
|
||||
# buscarron is a helpdesk bot
|
||||
# Project source code URL: https://gitlab.com/etke.cc/buscarron
|
||||
|
||||
matrix_bot_buscarron_enabled: true
|
||||
|
||||
matrix_bot_buscarron_container_image_self_build: false
|
||||
matrix_bot_buscarron_docker_repo: "https://gitlab.com/etke.cc/buscarron.git"
|
||||
matrix_bot_buscarron_docker_repo_version: "{{ matrix_bot_buscarron_version }}"
|
||||
matrix_bot_buscarron_docker_src_files_path: "{{ matrix_base_data_path }}/buscarron/docker-src"
|
||||
|
||||
matrix_bot_buscarron_version: v1.2.0
|
||||
matrix_bot_buscarron_docker_image: "{{ matrix_bot_buscarron_docker_image_name_prefix }}buscarron:{{ matrix_bot_buscarron_version }}"
|
||||
matrix_bot_buscarron_docker_image_name_prefix: "{{ 'localhost/' if matrix_bot_buscarron_container_image_self_build else 'registry.gitlab.com/etke.cc/' }}"
|
||||
matrix_bot_buscarron_docker_image_force_pull: "{{ matrix_bot_buscarron_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_bot_buscarron_base_path: "{{ matrix_base_data_path }}/buscarron"
|
||||
matrix_bot_buscarron_config_path: "{{ matrix_bot_buscarron_base_path }}/config"
|
||||
matrix_bot_buscarron_data_path: "{{ matrix_bot_buscarron_base_path }}/data"
|
||||
matrix_bot_buscarron_data_store_path: "{{ matrix_bot_buscarron_data_path }}/store"
|
||||
|
||||
# A list of extra arguments to pass to the container
|
||||
matrix_bot_buscarron_container_extra_arguments: []
|
||||
|
||||
# List of systemd services that matrix-bot-buscarron.service depends on
|
||||
matrix_bot_buscarron_systemd_required_services_list: ['docker.service']
|
||||
|
||||
# List of systemd services that matrix-bot-buscarron.service wants
|
||||
matrix_bot_buscarron_systemd_wanted_services_list: []
|
||||
|
||||
|
||||
# Database-related configuration fields.
|
||||
#
|
||||
# To use SQLite, stick to these defaults.
|
||||
#
|
||||
# To use Postgres:
|
||||
# - change the engine (`matrix_bot_buscarron_database_engine: 'postgres'`)
|
||||
# - adjust your database credentials via the `matrix_bot_buscarron_database_*` variables
|
||||
matrix_bot_buscarron_database_engine: 'sqlite'
|
||||
|
||||
matrix_bot_buscarron_sqlite_database_path_local: "{{ matrix_bot_buscarron_data_path }}/bot.db"
|
||||
matrix_bot_buscarron_sqlite_database_path_in_container: "/data/bot.db"
|
||||
|
||||
matrix_bot_buscarron_database_username: 'buscarron'
|
||||
matrix_bot_buscarron_database_password: 'some-password'
|
||||
matrix_bot_buscarron_database_hostname: 'matrix-postgres'
|
||||
matrix_bot_buscarron_database_port: 5432
|
||||
matrix_bot_buscarron_database_name: 'buscarron'
|
||||
|
||||
matrix_bot_buscarron_database_connection_string: 'postgres://{{ matrix_bot_buscarron_database_username }}:{{ matrix_bot_buscarron_database_password }}@{{ matrix_bot_buscarron_database_hostname }}:{{ matrix_bot_buscarron_database_port }}/{{ matrix_bot_buscarron_database_name }}?sslmode=disable'
|
||||
|
||||
matrix_bot_buscarron_storage_database: "{{
|
||||
{
|
||||
'sqlite': matrix_bot_buscarron_sqlite_database_path_in_container,
|
||||
'postgres': matrix_bot_buscarron_database_connection_string,
|
||||
}[matrix_bot_buscarron_database_engine]
|
||||
}}"
|
||||
|
||||
matrix_bot_buscarron_database_dialect: "{{
|
||||
{
|
||||
'sqlite': 'sqlite3',
|
||||
'postgres': 'postgres',
|
||||
}[matrix_bot_buscarron_database_engine]
|
||||
}}"
|
||||
|
||||
|
||||
# The bot's username. This user needs to be created manually beforehand.
|
||||
# Also see `matrix_bot_buscarron_password`.
|
||||
matrix_bot_buscarron_login: "bot.buscarron"
|
||||
|
||||
# The password that the bot uses to authenticate.
|
||||
matrix_bot_buscarron_password: ''
|
||||
|
||||
# the homeserver URL, uses internal synapse container address by default
|
||||
matrix_bot_buscarron_homeserver: "{{ matrix_homeserver_container_url }}"
|
||||
|
||||
# forms configuration
|
||||
matrix_bot_buscarron_forms: []
|
||||
|
||||
# Disable encryption
|
||||
matrix_bot_buscarron_noencryption:
|
||||
|
||||
# Sentry DSN
|
||||
matrix_bot_buscarron_sentry:
|
||||
|
||||
# Log level
|
||||
matrix_bot_buscarron_loglevel: INFO
|
||||
|
||||
# spam hosts/domains
|
||||
matrix_bot_buscarron_spam_hosts: []
|
||||
|
||||
# spam email addresses
|
||||
matrix_bot_buscarron_spam_emails: []
|
||||
|
||||
# spam email localparts
|
||||
matrix_bot_buscarron_spam_localparts: []
|
||||
|
||||
# Ban duration in hours
|
||||
matrix_bot_buscarron_ban_duration: 24
|
||||
|
||||
# Banlist size
|
||||
matrix_bot_buscarron_ban_size: 10000
|
||||
|
||||
# Postmark token (confirmation emails)
|
||||
matrix_bot_buscarron_pm_token:
|
||||
|
||||
# Postmark sender signature
|
||||
matrix_bot_buscarron_pm_from:
|
||||
|
||||
# Postmark confirmation email's reply-to
|
||||
matrix_bot_buscarron_pm_replyto:
|
||||
|
||||
# Additional environment variables to pass to the buscarron container
|
||||
#
|
||||
# Example:
|
||||
# matrix_bot_buscarron_environment_variables_extension: |
|
||||
# BUSCARRON_LOGLEVEL=DEBUG
|
||||
matrix_bot_buscarron_environment_variables_extension: ''
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-buscarron.service'] }}"
|
||||
when: matrix_bot_buscarron_enabled | bool
|
@ -0,0 +1,23 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
when: "run_setup | bool and matrix_bot_buscarron_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-bot-buscarron
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
when: "run_setup | bool and matrix_bot_buscarron_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-bot-buscarron
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||
when: "run_setup | bool and not matrix_bot_buscarron_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-bot-buscarron
|
@ -0,0 +1,103 @@
|
||||
---
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_bot_buscarron_requires_restart: false
|
||||
|
||||
- block:
|
||||
- name: Check if an SQLite database already exists
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_bot_buscarron_sqlite_database_path_local }}"
|
||||
register: matrix_bot_buscarron_sqlite_database_path_local_stat_result
|
||||
|
||||
- block:
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_postgres_db_migration_request:
|
||||
src: "{{ matrix_bot_buscarron_sqlite_database_path_local }}"
|
||||
dst: "{{ matrix_bot_buscarron_database_connection_string }}"
|
||||
caller: "{{ role_path | basename }}"
|
||||
engine_variable_name: 'matrix_bot_buscarron_database_engine'
|
||||
engine_old: 'sqlite'
|
||||
systemd_services_to_stop: ['matrix-bot-buscarron.service']
|
||||
|
||||
- ansible.builtin.import_role:
|
||||
name: matrix-postgres
|
||||
tasks_from: migrate_db_to_postgres
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_bot_buscarron_requires_restart: true
|
||||
when: "matrix_bot_buscarron_sqlite_database_path_local_stat_result.stat.exists | bool"
|
||||
when: "matrix_bot_buscarron_database_engine == 'postgres'"
|
||||
|
||||
- name: Ensure buscarron paths exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- {path: "{{ matrix_bot_buscarron_config_path }}", when: true}
|
||||
- {path: "{{ matrix_bot_buscarron_data_path }}", when: true}
|
||||
- {path: "{{ matrix_bot_buscarron_data_store_path }}", when: true}
|
||||
- {path: "{{ matrix_bot_buscarron_docker_src_files_path }}", when: true}
|
||||
when: "item.when | bool"
|
||||
|
||||
- name: Ensure buscarron environment variables file created
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/env.j2"
|
||||
dest: "{{ matrix_bot_buscarron_config_path }}/env"
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
mode: 0640
|
||||
|
||||
- name: Ensure buscarron image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_bot_buscarron_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_bot_buscarron_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_bot_buscarron_docker_image_force_pull }}"
|
||||
when: "not matrix_bot_buscarron_container_image_self_build | bool"
|
||||
register: result
|
||||
retries: "{{ matrix_container_retries_count }}"
|
||||
delay: "{{ matrix_container_retries_delay }}"
|
||||
until: result is not failed
|
||||
|
||||
- name: Ensure buscarron repository is present on self-build
|
||||
ansible.builtin.git:
|
||||
repo: "{{ matrix_bot_buscarron_docker_repo }}"
|
||||
version: "{{ matrix_bot_buscarron_docker_repo_version }}"
|
||||
dest: "{{ matrix_bot_buscarron_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
become: true
|
||||
become_user: "{{ matrix_user_username }}"
|
||||
register: matrix_bot_buscarron_git_pull_results
|
||||
when: "matrix_bot_buscarron_container_image_self_build | bool"
|
||||
|
||||
- name: Ensure buscarron image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_bot_buscarron_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_bot_buscarron_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mailer_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_bot_buscarron_docker_src_files_path }}"
|
||||
pull: true
|
||||
when: "matrix_bot_buscarron_container_image_self_build | bool"
|
||||
|
||||
- name: Ensure matrix-bot-buscarron.service installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-bot-buscarron.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-bot-buscarron.service"
|
||||
mode: 0644
|
||||
register: matrix_bot_buscarron_systemd_service_result
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-bot-buscarron.service installation
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_bot_buscarron_systemd_service_result.changed | bool"
|
||||
|
||||
- name: Ensure matrix-bot-buscarron.service restarted, if necessary
|
||||
ansible.builtin.service:
|
||||
name: "matrix-bot-buscarron.service"
|
||||
state: restarted
|
||||
when: "matrix_bot_buscarron_requires_restart | bool"
|
@ -0,0 +1,36 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-buscarron service
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-bot-buscarron.service"
|
||||
register: matrix_bot_buscarron_service_stat
|
||||
|
||||
- name: Ensure matrix-buscarron is stopped
|
||||
ansible.builtin.service:
|
||||
name: matrix-bot-buscarron
|
||||
state: stopped
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
register: stopping_result
|
||||
when: "matrix_bot_buscarron_service_stat.stat.exists | bool"
|
||||
|
||||
- name: Ensure matrix-bot-buscarron.service doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-bot-buscarron.service"
|
||||
state: absent
|
||||
when: "matrix_bot_buscarron_service_stat.stat.exists | bool"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-bot-buscarron.service removal
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_bot_buscarron_service_stat.stat.exists | bool"
|
||||
|
||||
- name: Ensure Matrix buscarron paths don't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_bot_buscarron_base_path }}"
|
||||
state: absent
|
||||
|
||||
- name: Ensure buscarron Docker image doesn't exist
|
||||
docker_image:
|
||||
name: "{{ matrix_bot_buscarron_docker_image }}"
|
||||
state: absent
|
@ -1,10 +1,9 @@
|
||||
---
|
||||
|
||||
- name: Fail if required settings not defined
|
||||
fail:
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
You need to define a required configuration setting (`{{ item }}`).
|
||||
when: "vars[item] == ''"
|
||||
with_items:
|
||||
- "matrix_mx_puppet_skype_appservice_token"
|
||||
- "matrix_mx_puppet_skype_homeserver_token"
|
||||
- "matrix_bot_buscarron_password"
|
@ -0,0 +1,29 @@
|
||||
BUSCARRON_LOGIN={{ matrix_bot_buscarron_login }}
|
||||
BUSCARRON_PASSWORD={{ matrix_bot_buscarron_password }}
|
||||
BUSCARRON_HOMESERVER={{ matrix_bot_buscarron_homeserver }}
|
||||
BUSCARRON_DB_DSN={{ matrix_bot_buscarron_database_connection_string }}
|
||||
BUSCARRON_DB_DIALECT={{ matrix_bot_buscarron_database_dialect }}
|
||||
BUSCARRON_SPAM_HOSTS={{ matrix_bot_buscarron_spam_hosts|join(" ") }}
|
||||
BUSCARRON_SPAM_EMAILS={{ matrix_bot_buscarron_spam_emails|join(" ") }}
|
||||
BUSCARRON_SPAM_LOCALPARTS={{ matrix_bot_buscarron_spam_localparts|join(" ") }}
|
||||
BUSCARRON_SENTRY={{ matrix_bot_buscarron_sentry }}
|
||||
BUSCARRON_LOGLEVEL={{ matrix_bot_buscarron_loglevel }}
|
||||
BUSCARRON_BAN_DURATION={{ matrix_bot_buscarron_ban_duration }}
|
||||
BUSCARRON_BAN_SIZE={{ matrix_bot_buscarron_ban_size }}
|
||||
BUSCARRON_PM_TOKEN={{ matrix_bot_buscarron_pm_token }}
|
||||
BUSCARRON_PM_FROM={{ matrix_bot_buscarron_pm_from }}
|
||||
BUSCARRON_PM_REPLYTO={{ matrix_bot_buscarron_pm_replyto }}
|
||||
BUSCARRON_NOENCRYPTION={{ matrix_bot_buscarron_noencryption }}
|
||||
{% set forms = [] %}
|
||||
{% for form in matrix_bot_buscarron_forms -%}{{- forms.append(form.name) -}}
|
||||
BUSCARRON_{{ form.name|upper }}_ROOM={{ form.room|default('') }}
|
||||
BUSCARRON_{{ form.name|upper }}_REDIRECT={{ form.redirect|default('') }}
|
||||
BUSCARRON_{{ form.name|upper }}_HASDOMAIN={{ form.hasdomain|default('') }}
|
||||
BUSCARRON_{{ form.name|upper }}_RATELIMIT={{ form.ratelimit|default('') }}
|
||||
BUSCARRON_{{ form.name|upper }}_EXTENSIONS={{ form.extensions|default('')|join(' ') }}
|
||||
BUSCARRON_{{ form.name|upper }}_CONFIRMATION_SUBJECT={{ form.confirmation_subject|default('') }}
|
||||
BUSCARRON_{{ form.name|upper }}_CONFIRMATION_BODY={{ form.confirmation_body|default('') }}
|
||||
{% endfor %}
|
||||
BUSCARRON_LIST={{ forms|join(" ") }}
|
||||
|
||||
{{ matrix_bot_buscarron_environment_variables_extension }}
|
@ -0,0 +1,39 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Matrix web forms bot
|
||||
{% for service in matrix_bot_buscarron_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
{% for service in matrix_bot_buscarron_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment="HOME={{ matrix_systemd_unit_home_path }}"
|
||||
ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-bot-buscarron 2>/dev/null || true'
|
||||
ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-bot-buscarron 2>/dev/null || true'
|
||||
|
||||
ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-bot-buscarron \
|
||||
--log-driver=none \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--cap-drop=ALL \
|
||||
--read-only \
|
||||
--network={{ matrix_docker_network }} \
|
||||
--env-file={{ matrix_bot_buscarron_config_path }}/env \
|
||||
--mount type=bind,src={{ matrix_bot_buscarron_data_path }},dst=/data \
|
||||
{% for arg in matrix_bot_buscarron_container_extra_arguments %}
|
||||
{{ arg }} \
|
||||
{% endfor %}
|
||||
{{ matrix_bot_buscarron_docker_image }}
|
||||
|
||||
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-bot-buscarron 2>/dev/null || true'
|
||||
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-bot-buscarron 2>/dev/null || true'
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-bot-buscarron
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
|
||||
- set_fact:
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-go-neb.service'] }}"
|
||||
when: matrix_bot_go_neb_enabled | bool
|
||||
|
@ -1,13 +1,13 @@
|
||||
---
|
||||
|
||||
- name: Fail if there's not at least 1 client
|
||||
fail:
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
You need at least 1 client in the matrix_bot_go_neb_clients block.
|
||||
when: matrix_bot_go_neb_clients is not defined or matrix_bot_go_neb_clients[0] is not defined
|
||||
|
||||
- name: Fail if there's not at least 1 service
|
||||
fail:
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
You need at least 1 service in the matrix_bot_go_neb_services block.
|
||||
when: matrix_bot_go_neb_services is not defined or matrix_bot_go_neb_services[0] is not defined
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
|
||||
- set_fact:
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-honoroit.service'] }}"
|
||||
when: matrix_bot_honoroit_enabled | bool
|
||||
|
@ -0,0 +1,50 @@
|
||||
---
|
||||
# matrix-registration-bot creates and manages registration tokens for a matrix server
|
||||
# Project source code URL: https://github.com/moan0s/matrix-registration-bot
|
||||
|
||||
matrix_bot_matrix_registration_bot_enabled: true
|
||||
matrix_bot_matrix_registration_bot_container_image_self_build: false
|
||||
matrix_bot_matrix_registration_bot_docker_repo: "https://github.com/moan0s/matrix-registration-bot.git"
|
||||
matrix_bot_matrix_registration_bot_docker_repo_version: "{{ matrix_bot_matrix_registration_bot_version if matrix_bot_matrix_registration_bot_version != 'latest' else 'main' }}"
|
||||
matrix_bot_matrix_registration_bot_docker_src_files_path: "{{ matrix_bot_matrix_registration_bot_base_path }}/docker-src"
|
||||
|
||||
matrix_bot_matrix_registration_bot_version: latest
|
||||
matrix_bot_matrix_registration_bot_docker_image: "{{ matrix_container_global_registry_prefix }}moanos/matrix-registration-bot:{{ matrix_bot_matrix_registration_bot_version }}"
|
||||
matrix_bot_matrix_registration_bot_docker_image_force_pull: "{{ matrix_bot_matrix_registration_bot_docker_image.endswith(':latest') }}"
|
||||
|
||||
matrix_bot_matrix_registration_bot_base_path: "{{ matrix_base_data_path }}/matrix-registration-bot"
|
||||
matrix_bot_matrix_registration_bot_config_path: "{{ matrix_bot_matrix_registration_bot_base_path }}/config"
|
||||
matrix_bot_matrix_registration_bot_data_path: "{{ matrix_bot_matrix_registration_bot_base_path }}/data"
|
||||
|
||||
matrix_bot_matrix_registration_bot_bot_server: "https://{{ matrix_server_fqn_matrix }}"
|
||||
matrix_bot_matrix_registration_bot_api_base_url: "https://{{ matrix_server_fqn_matrix }}"
|
||||
|
||||
# The access token that the bot uses to communicate in Matrix chats
|
||||
# This does not necessarily need to be a privileged (admin) access token.
|
||||
matrix_bot_matrix_registration_bot_bot_access_token: ''
|
||||
|
||||
# The access token that the bot uses to call the Matrix API for creating registration tokens.
|
||||
# This needs to be a privileged (admin) access token.
|
||||
# By default, we assume `matrix_bot_matrix_registration_bot_bot_access_token` is such a privileged token and we use it as is.
|
||||
# If necessary, you can define your own other access token here, which might even be for a different Matrix user.
|
||||
matrix_bot_matrix_registration_bot_api_token: "{{ matrix_bot_matrix_registration_bot_bot_access_token }}"
|
||||
|
||||
matrix_bot_matrix_registration_bot_logging_level: info
|
||||
matrix_bot_matrix_registration_environment_variables_extension: ''
|
||||
|
||||
# A list of extra arguments to pass to the container
|
||||
matrix_bot_matrix_registration_bot_container_extra_arguments: []
|
||||
|
||||
# List of systemd services that matrix-bot-matrix-registration-bot.service depends on
|
||||
matrix_bot_matrix_registration_bot_systemd_required_services_list: ['docker.service']
|
||||
|
||||
# List of systemd services that matrix-bot-matrix-registration-bot.service wants
|
||||
matrix_bot_matrix_registration_bot_systemd_wanted_services_list: []
|
||||
|
||||
# The bot's username. This user needs to be created manually beforehand.
|
||||
# Also see `matrix_bot_matrix_registration_bot_user_password`.
|
||||
matrix_bot_matrix_registration_bot_matrix_user_id_localpart: "bot.matrix-registration-bot"
|
||||
|
||||
matrix_bot_matrix_registration_bot_matrix_user_id: '@{{ matrix_bot_matrix_registration_bot_matrix_user_id_localpart }}:{{ matrix_domain }}'
|
||||
|
||||
matrix_bot_matrix_registration_bot_matrix_homeserver_url: "{{ matrix_homeserver_container_url }}"
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-matrix-registration-bot.service'] }}"
|
||||
when: matrix_bot_matrix_registration_bot_enabled | bool
|
@ -0,0 +1,23 @@
|
||||
---
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/init.yml"
|
||||
tags:
|
||||
- always
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
||||
when: "run_setup | bool and matrix_bot_matrix_registration_bot_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-bot-matrix-registration-bot
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_install.yml"
|
||||
when: "run_setup | bool and matrix_bot_matrix_registration_bot_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-bot-matrix-registration-bot
|
||||
|
||||
- ansible.builtin.import_tasks: "{{ role_path }}/tasks/setup_uninstall.yml"
|
||||
when: "run_setup | bool and not matrix_bot_matrix_registration_bot_enabled | bool"
|
||||
tags:
|
||||
- setup-all
|
||||
- setup-bot-matrix-registration-bot
|
@ -0,0 +1,74 @@
|
||||
---
|
||||
|
||||
- name: Ensure matrix-registration-bot paths exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ item.path }}"
|
||||
state: directory
|
||||
mode: 0750
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
with_items:
|
||||
- {path: "{{ matrix_bot_matrix_registration_bot_config_path }}", when: true}
|
||||
- - {path: "{{ matrix_bot_matrix_registration_bot_data_path }}", when: true}
|
||||
- {path: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}", when: true}
|
||||
when: "item.when | bool"
|
||||
|
||||
- name: Ensure matrix-registration-bot configuration file created
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/config/config.yml.j2"
|
||||
dest: "{{ matrix_bot_matrix_registration_bot_config_path }}/config.yml"
|
||||
owner: "{{ matrix_user_username }}"
|
||||
group: "{{ matrix_user_groupname }}"
|
||||
mode: 0640
|
||||
|
||||
- name: Ensure matrix-registration-bot image is pulled
|
||||
docker_image:
|
||||
name: "{{ matrix_bot_matrix_registration_bot_docker_image }}"
|
||||
source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
|
||||
force_source: "{{ matrix_bot_matrix_registration_bot_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_bot_matrix_registration_bot_docker_image_force_pull }}"
|
||||
when: "not matrix_bot_matrix_registration_bot_container_image_self_build | bool"
|
||||
register: result
|
||||
retries: "{{ matrix_container_retries_count }}"
|
||||
delay: "{{ matrix_container_retries_delay }}"
|
||||
until: result is not failed
|
||||
|
||||
- name: Ensure matrix-registration-bot repository is present on self-build
|
||||
ansible.builtin.git:
|
||||
repo: "{{ matrix_bot_matrix_registration_bot_docker_repo }}"
|
||||
version: "{{ matrix_bot_matrix_registration_bot_docker_repo_version }}"
|
||||
dest: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}"
|
||||
force: "yes"
|
||||
become: true
|
||||
become_user: "{{ matrix_user_username }}"
|
||||
register: matrix_bot_matrix_registration_bot_git_pull_results
|
||||
when: "matrix_bot_matrix_registration_bot_container_image_self_build | bool"
|
||||
|
||||
- name: Ensure matrix-registration-bot image is built
|
||||
docker_image:
|
||||
name: "{{ matrix_bot_matrix_registration_bot_docker_image }}"
|
||||
source: build
|
||||
force_source: "{{ matrix_bot_matrix_registration_bot_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
|
||||
force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mailer_git_pull_results.changed }}"
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
path: "{{ matrix_bot_matrix_registration_bot_docker_src_files_path }}"
|
||||
pull: true
|
||||
when: "matrix_bot_matrix_registration_bot_container_image_self_build | bool"
|
||||
|
||||
- name: Ensure matrix-bot-matrix-registration-bot.service installed
|
||||
ansible.builtin.template:
|
||||
src: "{{ role_path }}/templates/systemd/matrix-bot-matrix-registration-bot.service.j2"
|
||||
dest: "{{ matrix_systemd_path }}/matrix-bot-matrix-registration-bot.service"
|
||||
mode: 0644
|
||||
register: matrix_bot_matrix_registration_bot_systemd_service_result
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-bot-matrix-registration-bot.service installation
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_bot_matrix_registration_bot_systemd_service_result.changed | bool"
|
||||
|
||||
- name: Ensure matrix-bot-matrix-registration-bot.service restarted, if necessary
|
||||
ansible.builtin.service:
|
||||
name: "matrix-bot-matrix-registration-bot.service"
|
||||
state: restarted
|
@ -0,0 +1,36 @@
|
||||
---
|
||||
|
||||
- name: Check existence of matrix-matrix-registration-bot service
|
||||
ansible.builtin.stat:
|
||||
path: "{{ matrix_systemd_path }}/matrix-bot-matrix-registration-bot.service"
|
||||
register: matrix_bot_matrix_registration_bot_service_stat
|
||||
|
||||
- name: Ensure matrix-matrix-registration-bot is stopped
|
||||
ansible.builtin.service:
|
||||
name: matrix-bot-matrix-registration-bot
|
||||
state: stopped
|
||||
enabled: false
|
||||
daemon_reload: true
|
||||
register: stopping_result
|
||||
when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists | bool"
|
||||
|
||||
- name: Ensure matrix-bot-matrix-registration-bot.service doesn't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_systemd_path }}/matrix-bot-matrix-registration-bot.service"
|
||||
state: absent
|
||||
when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists | bool"
|
||||
|
||||
- name: Ensure systemd reloaded after matrix-bot-matrix-registration-bot.service removal
|
||||
ansible.builtin.service:
|
||||
daemon_reload: true
|
||||
when: "matrix_bot_matrix_registration_bot_service_stat.stat.exists | bool"
|
||||
|
||||
- name: Ensure Matrix matrix-registration-bot paths don't exist
|
||||
ansible.builtin.file:
|
||||
path: "{{ matrix_bot_matrix_registration_bot_base_path }}"
|
||||
state: absent
|
||||
|
||||
- name: Ensure matrix-registration-bot Docker image doesn't exist
|
||||
docker_image:
|
||||
name: "{{ matrix_bot_matrix_registration_bot_docker_image }}"
|
||||
state: absent
|
@ -0,0 +1,10 @@
|
||||
---
|
||||
|
||||
- name: Fail if required settings not defined
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
You need to define a required configuration setting (`{{ item }}`).
|
||||
when: "vars[item] == ''"
|
||||
with_items:
|
||||
- "matrix_bot_matrix_registration_bot_bot_access_token"
|
||||
- "matrix_bot_matrix_registration_bot_api_token"
|
@ -0,0 +1,12 @@
|
||||
bot:
|
||||
server: {{ matrix_bot_matrix_registration_bot_bot_server|to_json }}
|
||||
username: {{ matrix_bot_matrix_registration_bot_matrix_user_id_localpart|to_json }}
|
||||
access_token: {{ matrix_bot_matrix_registration_bot_bot_access_token|to_json }}
|
||||
api:
|
||||
# API endpoint of the registration tokens
|
||||
base_url: {{ matrix_bot_matrix_registration_bot_api_base_url|to_json }}
|
||||
# Access token of an administrator on the server
|
||||
token: {{ matrix_bot_matrix_registration_bot_api_token|to_json }}
|
||||
logging:
|
||||
level: {{ matrix_bot_matrix_registration_bot_logging_level|to_json }}
|
||||
|
@ -0,0 +1,37 @@
|
||||
#jinja2: lstrip_blocks: "True"
|
||||
[Unit]
|
||||
Description=Matrix registration bot
|
||||
{% for service in matrix_bot_matrix_registration_bot_systemd_required_services_list %}
|
||||
Requires={{ service }}
|
||||
After={{ service }}
|
||||
{% endfor %}
|
||||
{% for service in matrix_bot_matrix_registration_bot_systemd_wanted_services_list %}
|
||||
Wants={{ service }}
|
||||
{% endfor %}
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Environment="HOME={{ matrix_systemd_unit_home_path }}"
|
||||
ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-bot-matrix-registration-bot 2>/dev/null || true'
|
||||
ExecStartPre=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-bot-matrix-registration-bot 2>/dev/null || true'
|
||||
|
||||
ExecStart={{ matrix_host_command_docker }} run --rm --name matrix-bot-matrix-registration-bot \
|
||||
--log-driver=none \
|
||||
--cap-drop=ALL \
|
||||
-e "CONFIG_PATH=/config/config.yml" \
|
||||
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
|
||||
--read-only \
|
||||
--mount type=bind,src={{ matrix_bot_matrix_registration_bot_config_path }},dst=/config,ro \
|
||||
--mount type=bind,src={{ matrix_bot_matrix_registration_bot_data_path }},dst=/data \
|
||||
--network={{ matrix_docker_network }} \
|
||||
{{ matrix_bot_matrix_registration_bot_docker_image }}
|
||||
|
||||
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} kill matrix-bot-matrix-registration-bot 2>/dev/null || true'
|
||||
ExecStop=-{{ matrix_host_command_sh }} -c '{{ matrix_host_command_docker }} rm matrix-bot-matrix-registration-bot 2>/dev/null || true'
|
||||
Restart=always
|
||||
RestartSec=30
|
||||
SyslogIdentifier=matrix-bot-matrix-registration-bot
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
|
||||
- set_fact:
|
||||
- ansible.builtin.set_fact:
|
||||
matrix_systemd_services_list: "{{ matrix_systemd_services_list + ['matrix-bot-matrix-reminder-bot.service'] }}"
|
||||
when: matrix_bot_matrix_reminder_bot_enabled | bool
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue