Updated for external DB.
authorLuke Hoersten <luke@hoersten.org>
Mon, 31 Dec 2018 15:50:19 -0600
changeset 66 652a236229c2
parent 65 4538ad030906
child 67 bd34ae082697
Updated for external DB.
roles/pleroma/defaults/main.yaml
roles/pleroma/tasks/main.yaml
roles/pleroma/templates/setup_db.psql.j2
--- a/roles/pleroma/defaults/main.yaml	Sun Dec 30 11:13:20 2018 -0600
+++ b/roles/pleroma/defaults/main.yaml	Mon Dec 31 15:50:19 2018 -0600
@@ -10,3 +10,4 @@
 pleroma_char_limit: 5000
 pleroma_signup_open: "true"
 pleroma_db_host: "localhost"
+pleroma_db_superuser: "postgres"
--- a/roles/pleroma/tasks/main.yaml	Sun Dec 30 11:13:20 2018 -0600
+++ b/roles/pleroma/tasks/main.yaml	Mon Dec 31 15:50:19 2018 -0600
@@ -50,9 +50,12 @@
 
 - name: install pleroma psql
   become: yes
-  become_user: "postgres"
-  command: "psql -f ~{{pleroma_user}}/pleroma/config/setup_db.psql"
+  become_user: "{{pleroma_db_superuser}}"
+  command: "psql -f ~{{pleroma_user}}/pleroma/config/setup_db.psql -h {{pleroma_db_host}}"
   notify: restart pleroma
+  environment:
+    PGUSER: "{{pleroma_db_superuser}}"
+    PGPASSWORD: "{{pleroma_db_superpass}}"
 
 - name: migrate db
   become: yes
--- a/roles/pleroma/templates/setup_db.psql.j2	Sun Dec 30 11:13:20 2018 -0600
+++ b/roles/pleroma/templates/setup_db.psql.j2	Mon Dec 31 15:50:19 2018 -0600
@@ -1,5 +1,6 @@
 CREATE USER {{pleroma_user}} WITH ENCRYPTED PASSWORD '{{pleroma_db_passwd}}';
-CREATE DATABASE {{pleroma_user}} OWNER {{pleroma_user}};
+CREATE DATABASE {{pleroma_user}};
+ALTER DATABASE {{pleroma_user}} OWNER TO {{pleroma_user}};
 \c {{pleroma_user}};
 --Extensions made by ecto.migrate that need superuser access
 CREATE EXTENSION IF NOT EXISTS citext;