diff --git a/postgres/defaults.yaml b/postgres/defaults.yaml index d50f5a3..3c64ece 100644 --- a/postgres/defaults.yaml +++ b/postgres/defaults.yaml @@ -7,6 +7,7 @@ postgres: python: python-psycopg2 service: postgresql conf_dir: /var/lib/pgsql/data + runtime_dir: /var/lib/pgsql/data create_cluster: False init_db: False version: 9.1 @@ -21,5 +22,6 @@ postgres: commands: initdb: service postgresql initdb initdb_user: root + initdb_args: --data-checksum user: postgres group: postgres diff --git a/postgres/init.sls b/postgres/init.sls index 4fd4e16..97d99fa 100644 --- a/postgres/init.sls +++ b/postgres/init.sls @@ -32,8 +32,8 @@ postgresql-initdb: cmd.run: - cwd: / - user: {{ postgres.initdb_user }} - - name: {{ postgres.commands.initdb }} - - unless: test -f {{ postgres.conf_dir }}/postgresql.conf + - name: {{ postgres.commands.initdb }} {{ postgres.initdb_args }} -D {{ postgres.runtime_dir }} + - unless: test -f {{ postgres.runtime_dir }}/PG_VERSION - env: LC_ALL: C.UTF-8 {% endif %} diff --git a/postgres/osmap.yaml b/postgres/osmap.yaml index 15352c2..23abd64 100644 --- a/postgres/osmap.yaml +++ b/postgres/osmap.yaml @@ -1,7 +1,8 @@ RedHat: init_db: True commands: - initdb: initdb /var/lib/pgsql/data + initdb: initdb + initdb_user: postgres pkg: postgresql-server pkg_client: postgresql pkg_repo: pgdg94 @@ -11,8 +12,10 @@ Debian: pkg_repo_file: /etc/apt/sources.list.d/pgdg.list pkg_libpq_dev: libpq-dev Suse: + init_db: True commands: - initdb: initdb /var/lib/pgsql/data + initdb: initdb + initdb_user: postgres pkg: postgresql-server pkg_client: postgresql FreeBSD: