Add mautrix-whatsapp role
This commit is contained in:
1
roles/mautrix_whatsapp/README.md
Normal file
1
roles/mautrix_whatsapp/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Sets up a mautrix-whatsapp bridge
|
||||
5
roles/mautrix_whatsapp/defaults/main.yaml
Normal file
5
roles/mautrix_whatsapp/defaults/main.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
mautrix_whatsapp_os_name: Matrix bridge
|
||||
mautrix_whatsapp_bot_displayname: WhatsApp bridge
|
||||
mautrix_whatsapp_default_relays: []
|
||||
mautrix_whatsapp_permissions: {}
|
||||
57
roles/mautrix_whatsapp/meta/argument_specs.yaml
Normal file
57
roles/mautrix_whatsapp/meta/argument_specs.yaml
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
argument_specs:
|
||||
main:
|
||||
description:
|
||||
- Sets up a mautrix-whatsapp bridge
|
||||
options:
|
||||
mautrix_whatsapp_homeserver_name:
|
||||
description: Matrix server name of homeserver the bridge is connected to.
|
||||
type: str
|
||||
required: true
|
||||
mautrix_whatsapp_as_token:
|
||||
description: A secret token that the application service will use to authenticate requests to the homeserver
|
||||
type: str
|
||||
required: true
|
||||
mautrix_whatsapp_hs_token:
|
||||
description: A secret token that the homeserver will use authenticate requests to the application service
|
||||
type: str
|
||||
required: true
|
||||
mautrix_whatsapp_doublepuppet_token:
|
||||
description: Double puppeting as token to impersonate matrix users
|
||||
type: str
|
||||
required: true
|
||||
mautrix_whatsapp_os_name:
|
||||
description: Device name that's shown in the "WhatsApp Web" section in the mobile app
|
||||
type: str
|
||||
required: false
|
||||
default: Matrix bridge
|
||||
mautrix_whatsapp_bot_displayname:
|
||||
description: Display name for the bridge bot
|
||||
type: str
|
||||
required: false
|
||||
default: WhatsApp bridge
|
||||
mautrix_whatsapp_default_relays:
|
||||
description: List of user login IDs which anyone can set as a relay, as long as the relay user is in the room
|
||||
type: list
|
||||
required: false
|
||||
default: []
|
||||
elements: str
|
||||
mautrix_whatsapp_permissions:
|
||||
description: Permissions for using the bridge. All users are given the relay permission regardless of this.
|
||||
type: list
|
||||
required: false
|
||||
default: []
|
||||
elements: dict
|
||||
options:
|
||||
key:
|
||||
description: Domain or user id to apply permission value to
|
||||
type: str
|
||||
required: true
|
||||
value:
|
||||
description: Permission value to apply
|
||||
type: str
|
||||
required: true
|
||||
choices:
|
||||
- commands
|
||||
- user
|
||||
- admin
|
||||
32
roles/mautrix_whatsapp/tasks/main.yaml
Normal file
32
roles/mautrix_whatsapp/tasks/main.yaml
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
- name: Mautrix-WhatsApp container
|
||||
ansible.builtin.import_role:
|
||||
name: service
|
||||
vars:
|
||||
service_name: mautrix-whatsapp
|
||||
service_container_image: "{{ _mautrix_whatsapp_image }}"
|
||||
service_container_user: 1337:1337
|
||||
service_container_command:
|
||||
- /usr/bin/mautrix-whatsapp
|
||||
- --no-update
|
||||
service_database_type: postgres
|
||||
service_container_additional_networks:
|
||||
- synapse-mautrix-whatsapp
|
||||
service_container_mounts:
|
||||
- type: template
|
||||
source: config.yaml.j2
|
||||
destination: /data/config.yaml
|
||||
service_container_secrets:
|
||||
- name: as-token
|
||||
value: "{{ mautrix_whatsapp_as_token }}"
|
||||
- name: hs-token
|
||||
value: "{{ mautrix_whatsapp_hs_token }}"
|
||||
- name: doublepuppet-token
|
||||
value: as_token:{{ mautrix_whatsapp_doublepuppet_token }}
|
||||
- name: encryption-pickle-key
|
||||
service_container_env:
|
||||
BRIDGE_DATABASE__URI_FILE: /run/secrets/postgres-url
|
||||
BRIDGE_APPSERVICE__AS_TOKEN_FILE: /run/secrets/as-token
|
||||
BRIDGE_APPSERVICE__HS_TOKEN_FILE: /run/secrets/hs-token
|
||||
BRIDGE_ENCRYPTION__PICKLE_KEY: /run/secrets/encryption-pickle-key
|
||||
"BRIDGE_DOUBLE_PUPPET__SECRETS__{{ mautrix_whatsapp_homeserver_name }}": /run/secrets/doublepuppet-token
|
||||
73
roles/mautrix_whatsapp/templates/config.yaml.j2
Normal file
73
roles/mautrix_whatsapp/templates/config.yaml.j2
Normal file
@@ -0,0 +1,73 @@
|
||||
---
|
||||
# vim:ft=yaml
|
||||
# {{ ansible_managed }}
|
||||
|
||||
network:
|
||||
os_name: "{{ mautrix_whatsapp_os_name }}"
|
||||
|
||||
send_presence_on_typing: true
|
||||
url_previews: true
|
||||
extev_polls: true
|
||||
|
||||
bridge:
|
||||
cleanup_on_logout:
|
||||
enabled: true
|
||||
manual:
|
||||
private: nothing
|
||||
relayed: nothing
|
||||
shared_no_users: kick
|
||||
shared_has_users: kick
|
||||
bad_credentials:
|
||||
private: nothing
|
||||
relayed: nothing
|
||||
shared_no_users: kick
|
||||
shared_has_users: kick
|
||||
|
||||
relay:
|
||||
enabled: true
|
||||
admin_only: true
|
||||
default_relays:
|
||||
{{ mautrix_whatsapp_default_relays | to_nice_yaml | indent(4) }}
|
||||
permissions:
|
||||
"*": relay
|
||||
{% for item in mautrix_whatsapp_permissions %}
|
||||
"{{ item.key }}": {{ item.value }}
|
||||
{% endfor %}
|
||||
|
||||
database:
|
||||
type: postgres
|
||||
|
||||
homeserver:
|
||||
address: http://synapse:8009
|
||||
domain: {{ mautrix_whatsapp_homeserver_name }}
|
||||
async_media: true
|
||||
|
||||
appservice:
|
||||
address: http://mautrix-whatsapp:8080
|
||||
hostname: 0.0.0.0
|
||||
port: 8080
|
||||
id: whatsapp
|
||||
bot:
|
||||
username: whatsappbot
|
||||
displayname: {{ mautrix_whatsapp_bot_displayname }}
|
||||
|
||||
matrix:
|
||||
delivery_receipts: true
|
||||
|
||||
provisioning:
|
||||
shared_secret: disable
|
||||
|
||||
encryption:
|
||||
allow: true
|
||||
default: false
|
||||
msc4190: true
|
||||
|
||||
allow_key_sharing: true
|
||||
|
||||
env_config_prefix: BRIDGE_
|
||||
|
||||
logging:
|
||||
min_level: info
|
||||
writers:
|
||||
- type: stdout
|
||||
format: pretty-colored
|
||||
2
roles/mautrix_whatsapp/vars/main.yaml
Normal file
2
roles/mautrix_whatsapp/vars/main.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
_mautrix_whatsapp_image: dock.mau.dev/mautrix/whatsapp:latest
|
||||
Reference in New Issue
Block a user