[postgres] add an option in pillar to make the postgres user a superuser (closes #5438073)
authorKatia Saurfelt <katia.saurfelt@logilab.fr>
Fri, 05 Jun 2015 16:50:49 +0200
changeset 39 f4ce04853cb1
parent 38 939dee846ce3
child 40 54b3058cbca9
[postgres] add an option in pillar to make the postgres user a superuser (closes #5438073)
cubicweb/postgres.sls
pillar.example
--- a/cubicweb/postgres.sls	Fri Jun 05 16:48:51 2015 +0200
+++ b/cubicweb/postgres.sls	Fri Jun 05 16:50:49 2015 +0200
@@ -43,9 +43,16 @@
     - template: template0
     - require:
       - postgres_user: pg-{{vhostname}}-{{name}}
-      - service: postgresql
+      - service: pg-server
   postgres_extension.present:
     - name: plpythonu
+  postgres_user:
+    - present
+    - name: {{ config.database.user }}
+    - password: {{ config.database.password }}
+    {% if config.database.get('superuser', False) %}
+    - superuser: True
+    {% endif %}
     - require:
       - service: postgresql
       - pkg: postgresql-plpython-9.1
--- a/pillar.example	Fri Jun 05 16:48:51 2015 +0200
+++ b/pillar.example	Fri Jun 05 16:50:49 2015 +0200
@@ -38,6 +38,7 @@
         user: logidemo
         password: logidemo
         host: localhost
+        superuser: True # will create postgres user logidemo as superuser
         port: 5432
       cwapp:
         basepath: /demo/blog # will be served as http(s)://www.cubicweb.org/demo/blog