[postgres] the postgresql version is now configurable in pillar
authorKatia Saurfelt <katia.saurfelt@logilab.fr>
Thu, 04 Jun 2015 16:41:02 +0200
changeset 34 cda97f743aee
parent 33 a1670eb524e6
child 35 f1627c0a65fd
[postgres] the postgresql version is now configurable in pillar closes #5434794
cubicweb/postgres.sls
pillar.example
--- a/cubicweb/postgres.sls	Thu Apr 09 10:58:58 2015 +0200
+++ b/cubicweb/postgres.sls	Thu Jun 04 16:41:02 2015 +0200
@@ -1,8 +1,11 @@
+{% set psql_version=pillar.get('postgresql_version', 9.1) %}
+
 pg-server:
   pkg.installed:
     - pkgs:
-      - postgresql-9.1
-      - postgresql-contrib-9.1
+      - postgresql-{{ psql_version }}
+      - postgresql-contrib-{{ psql_version }}
+      - postgresql-plpython-{{ psql_version }}
   {% if grains['oscodename'] == 'wheezy' %}
   file.managed:
     - name: /etc/init.d/postgresql
@@ -13,14 +16,14 @@
   service.running:
     - name: postgresql
 
-postgresql-plpython-9.1:
+postgresql-plpython-{{ psql_version }}:
   pkg.installed
 
-/etc/postgresql/9.1/main/pg_hba.conf:
+/etc/postgresql/{{ psql_version }}/main/pg_hba.conf:
   file.append:
     - text:
           - host    all             all             0.0.0.0/0            md5
-    - watch_in : 
+    - watch_in :
       service: postgresql
 
 {% for vhostname, vhost in pillar['cubicweb_apps'].iteritems() %}
--- a/pillar.example	Thu Apr 09 10:58:58 2015 +0200
+++ b/pillar.example	Thu Jun 04 16:41:02 2015 +0200
@@ -17,6 +17,10 @@
 ## 'cubicweb_repo' option is ignored
 #cubicweb_version: 3.20.5-1
 
+## you may specify a precise postgresql version (package version). If set, the
+## 'postgresql_version' option is ignored
+# postgresql_version: 9.4
+
 ## you can add extra repository sources
 #extra_sources:
 #  - deb https://user:password@domain.com/path/dists/ wheezy/