Merge pull request #245 from gilou/optional_prepare

Make the preparation/initdb optional
This commit is contained in:
Niels Abspoel 2018-10-15 19:38:11 +02:00 committed by GitHub
commit 5108b88a8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -17,6 +17,7 @@ postgres:
group: postgres
prepare_cluster:
run: True
pgcommand: initdb -D
pgtestfile: PG_VERSION
user: postgres

View file

@ -67,6 +67,7 @@ postgresql-cluster-prepared:
- recurse:
- user
- group
{%- if postgres.prepare_cluster.run %}
cmd.run:
{%- if postgres.prepare_cluster.command is defined %}
{# support for depreciated 'prepare_cluster.command' pillar #}
@ -84,6 +85,7 @@ postgresql-cluster-prepared:
- file: postgresql-cluster-prepared
- watch_in:
- module: postgresql-service-restart
{%- endif %}
postgresql-config-dir:
file.directory:
@ -99,7 +101,11 @@ postgresql-config-dir:
- ignore_files
- makedirs: True
- require:
{%- if postgres.prepare_cluster.run %}
- cmd: postgresql-cluster-prepared
{%- else %}
- file: postgresql-cluster-prepared
{%- endif %}
{%- set db_port = salt['config.option']('postgres.port') %}
{%- if db_port %}