Cluster should be disabled by default, some minor fixes
Doesn't fix the stupid mixing of cluster vs. non-cluster setup but at
least it works.
diff --git a/postgresql/files/9.6/postgresql.conf.Debian b/postgresql/files/9.6/postgresql.conf.Debian
index e0fce11..d464597 100644
--- a/postgresql/files/9.6/postgresql.conf.Debian
+++ b/postgresql/files/9.6/postgresql.conf.Debian
@@ -59,7 +59,7 @@
{%- if server.bind.address == '0.0.0.0' %}
listen_addresses = '*'
{%- else %}
-listen_addresses = 'localhost{% if server.bind.address != "127.0.0.1" %}, {{ server.bind.address }}'{% endif %}
+listen_addresses = 'localhost{% if server.bind.address != "127.0.0.1" %}, {{ server.bind.address }}{% endif %}'
{%- endif %}
port = {{ server.bind.get('port', '5432') }}
diff --git a/postgresql/map.jinja b/postgresql/map.jinja
index 1cb9b4d..d7845fa 100644
--- a/postgresql/map.jinja
+++ b/postgresql/map.jinja
@@ -34,6 +34,7 @@
{%- set cluster = salt['grains.filter_by']({
'Debian': {
+ 'enabled': false,
'pkgs': [],
'service': 'postgresql',
'version': version,
diff --git a/postgresql/server.sls b/postgresql/server.sls
index a431669..93e4b0e 100644
--- a/postgresql/server.sls
+++ b/postgresql/server.sls
@@ -10,8 +10,7 @@
- names: {{ server.pkgs }}
{% endif %}
-{%- if grains.os_family == "Debian" %}
-
+{%- if cluster.get("enabled", False) %}
init_postgresql_cluster:
postgres_cluster.present:
- name: main
@@ -25,6 +24,7 @@
- require_in:
- file: {{ server.dir.config }}/pg_hba.conf
- file: {{ server.dir.config }}/postgresql.conf
+{%- endif %}
{{ server.dir.config }}/pg_hba.conf:
file.managed:
@@ -44,8 +44,6 @@
postgresql_version: {{ server.version }}
- mode: 600
-{%- endif %}
-
/root/.pgpass:
file.managed:
- source: salt://postgresql/files/pgpass
@@ -54,8 +52,6 @@
- group: root
- mode: 600
-{%- if grains.os_family == "Debian" %}
-
postgresql_service:
service.running:
- name: {{ server.service }}
@@ -110,8 +106,6 @@
{%- endfor %}
{%- endfor %}
-{%- endif %}
-
postgresql_dirs:
file.directory:
- names: