ctucx.git: ansible-configs

My personal ansible roles and playbooks [deprecated in favor of nixos]

commit 21504f0ba7c00b7e7123bf66d97ae9d31308c02c
parent e3a52cc2783ee965514e7ea9dfc5f41325454f63
Author: Leah (ctucx) <leah@ctu.cx>
Date: Mon, 1 Mar 2021 15:52:38 +0100

roles/synapse: create postgres database and user
2 files changed, 83 insertions(+), 0 deletions(-)
A
config-files/quitschi/schildichat-web.json
|
50
++++++++++++++++++++++++++++++++++++++++++++++++++
M
roles/synapse/tasks/configure.yml
|
33
+++++++++++++++++++++++++++++++++
diff --git a/config-files/quitschi/schildichat-web.json b/config-files/quitschi/schildichat-web.json
@@ -0,0 +1,49 @@
+{
+    "default_server_config": {
+        "m.homeserver": {
+            "base_url": "https://matrix.trans-agenda.de",
+            "server_name": "trans-agenda.de"
+        },
+        "m.identity_server": {
+            "base_url": "https://vector.im"
+        }
+    },
+    "disable_custom_urls": false,
+    "disable_guests": false,
+    "disable_login_language_selector": false,
+    "disable_3pid_login": true,
+    "brand": "matrix.trans-agenda.de",
+    "integrations_ui_url": "https://scalar.vector.im/",
+    "integrations_rest_url": "https://scalar.vector.im/api",
+    "integrations_widgets_urls": [
+        "https://scalar.vector.im/_matrix/integrations/v1",
+        "https://scalar.vector.im/api",
+        "https://scalar-staging.vector.im/_matrix/integrations/v1",
+        "https://scalar-staging.vector.im/api",
+        "https://scalar-staging.riot.im/scalar/api"
+    ],
+    "defaultCountryCode": "DE",
+    "showLabsSettings": true,
+    "features": {
+        "feature_new_spinner": true
+    },
+    "default_federate": true,
+    "default_theme": "dark",
+    "roomDirectory": {
+        "servers": [
+            "matrix.org"
+        ]
+    },
+    "enable_presence_by_hs_url": {
+        "https://matrix.org": false,
+        "https://matrix-client.matrix.org": false
+    },
+    "settingDefaults": {
+        "breadcrumbs": true,
+        "UIFeature.flair": false,
+        "UIFeature.communities": false
+    },
+    "jitsi": {
+        "preferredDomain": "meet.jit.si"
+    }
+}+
\ No newline at end of file
diff --git a/roles/synapse/tasks/configure.yml b/roles/synapse/tasks/configure.yml
@@ -59,3 +59,36 @@
     group: synapse
   when:
     - ansible_distribution == "Alpine" 
+
+- name: Create PostgreSQL-database for Synapse
+  become: yes
+  become_user: postgres
+  community.postgresql.postgresql_db:
+    name: synapse
+    encoding: UTF-8
+    lc_collate: C
+    lc_ctype: C
+    template: template0
+  when:
+    services.synapse.setupPostgreSQL is true
+
+- name: Create PostgreSQL-user for Synapse
+  become: yes
+  become_user: postgres
+  community.postgresql.postgresql_user:
+    db: synapse
+    name: synapse
+  when:
+    services.synapse.setupPostgreSQL is true
+
+- name: Grant all privileges
+  become: yes
+  become_user: postgres
+  community.postgresql.postgresql_privs:
+    db: postgres
+    privs: ALL
+    type: database
+    obj: library
+    role: librarian
+  when:
+    services.synapse.setupPostgreSQL is true