matrix.yml aktualisiert

This commit is contained in:
olli 2024-02-21 15:52:20 +01:00
parent f8dcd85b2c
commit 39c92e8b63

View File

@ -101,21 +101,27 @@
postgresqluser=$(pwgen -s 32 1) postgresqluser=$(pwgen -s 32 1)
postgresqlpassword=$(pwgen -s 32 1) postgresqlpassword=$(pwgen -s 32 1)
matrixadminpassword=$(pwgen -s 32 1) matrixadminpassword=$(pwgen -s 32 1)
matrixsrvuserpassword=$(pwgen -s 32 1)
[ -f env ] || echo "POSTGRES_USER=!POSTGRESUSER! [ -f env ] || echo "POSTGRES_USER=!POSTGRESUSER!
POSTGRES_PASSWORD=!POSTGRESPASSWORD! POSTGRES_PASSWORD=!POSTGRESPASSWORD!
MATRIX_ADMIN_PASSWORD=!MATRIX_ADMIN_PASSWORD! MATRIX_ADMIN_PASSWORD=!MATRIX_ADMIN_PASSWORD!
" >env " >env
[ -f env.user ] || echo "MATRIX_SRV_USER={{ ansible_facts['hostname'] }}
MATRIX_SRV_USER_PASSWORD=!MATRIX_SEV_USER_PASSWORD!
" >env.user
[ -f env.db ] || echo "POSTGRES_USER=!POSTGRESUSER! [ -f env.db ] || echo "POSTGRES_USER=!POSTGRESUSER!
POSTGRES_PASSWORD=!POSTGRESPASSWORD! POSTGRES_PASSWORD=!POSTGRESPASSWORD!
" >env.db " >env.db
chmod 440 env env.db chmod 440 env env.db env.user
chown root:docker env env.db chown root:docker env env.db env.user
sed -i "s/\!MATRIX_ADMIN_PASSWORD\!/$matrixadminpassword/g" env sed -i "s/\!MATRIX_ADMIN_PASSWORD\!/$matrixadminpassword/g" env
sed -i "s/\!POSTGRESUSER\!/$postgresqluser/g" env env.db sed -i "s/\!POSTGRESUSER\!/$postgresqluser/g" env env.db
sed -i "s/\!POSTGRESPASSWORD\!/$postgresqlpassword/g" env env.db sed -i "s/\!POSTGRESPASSWORD\!/$postgresqlpassword/g" env env.db
sed -i "s/\!MATRIX_SEV_USER_PASSWORD\!/$matrixsrvuserpassword/g" env.user
if ! grep -q "name: psycopg2" data/homeserver.yaml if ! grep -q "name: psycopg2" data/homeserver.yaml
then then
@ -449,7 +455,10 @@
sleep 120 sleep 120
cd /home/docker/matrix.{{inventory_hostname}} || exit 1 cd /home/docker/matrix.{{inventory_hostname}} || exit 1
. ./env . ./env
docker compose exec matrix.{{inventory_hostname}}--synapse register_new_matrix_user -c /data/homeserver.yaml -a -u mx-admin -p $MATRIX_ADMIN_PASSWORD http://localhost:8008 >matrix.init.log 2>&1 . ./env.user
date >>matrix.init.log
docker compose exec matrix.{{inventory_hostname}}--synapse register_new_matrix_user -c /data/homeserver.yaml -a -u mx-admin -p $MATRIX_ADMIN_PASSWORD http://localhost:8008 >>matrix.init.log 2>&1
docker compose exec matrix.{{inventory_hostname}}--synapse register_new_matrix_user -c /data/homeserver.yaml -u $MATRIX_SRV_USER -p $MATRIX_SRV_USER_PASSWORD http://localhost:8008 >>matrix.init.log 2>&1
backup: yes backup: yes
validate: /bin/bash -n %s validate: /bin/bash -n %s
# notify: run matrix.init # notify: run matrix.init