Split conf/data directories, support

This commit is contained in:
N
2018-06-18 23:46:29 +01:00
parent 501b0b678a
commit 764863fc8e
6 changed files with 44 additions and 35 deletions

View File

@@ -12,10 +12,10 @@ include:
postgresql-start:
cmd.run:
- name: pg_ctl -D {{ postgres.conf_dir }} -l logfile start
- name: pg_ctl -D {{ postgres.data_dir }} -l logfile start
- runas: {{ postgres.user }}
- unless:
- ps -p $(head -n 1 {{ postgres.conf_dir }}/postmaster.pid) 2>/dev/null
- ps -p $(head -n 1 {{ postgres.data_dir }}/postmaster.pid) 2>/dev/null
- require:
- file: postgresql-pg_hba

View File

@@ -61,27 +61,43 @@ postgresql-{{ bin }}-altinstall:
{%- endif %}
postgresql-cluster-prepared:
file.directory:
- name: {{ postgres.conf_dir }}
- user: {{ postgres.user }}
- group: {{ postgres.group }}
- makedirs: True
- recurse:
- user
- group
- dir_mode: 755
cmd.run:
{%- if postgres.prepare_cluster.command is defined %}
{# support for depreciated 'prepare_cluster.command' pillar #}
- name: {{ postgres.prepare_cluster.command }}
- unless: {{ postgres.prepare_cluster.test }}
{%- else %}
- name: {{ postgres.prepare_cluster.pgcommand }} {{ postgres.data_dir }}
- unless: test -f {{ postgres.data_dir }}/{{ postgres.prepare_cluster.pgtestfile }}
{%- endif %}
- cwd: /
- runas: {{ postgres.prepare_cluster.user }}
- env: {{ postgres.prepare_cluster.env }}
- unless:
- {{ postgres.prepare_cluster.test }}
- runas: {{ postgres.user }}
- require:
- pkg: postgresql-server
- file: postgresql-cluster-prepared
postgresql-config-dir:
file.directory:
- name: {{ postgres.conf_dir }}
- names:
- {{ postgres.data_dir }}
- {{ postgres.conf_dir }}
- user: {{ postgres.user }}
- group: {{ postgres.group }}
- dir_mode: {{ postgres.conf_dir_mode }}
- force: True
- file_mode: 644
- recurse:
- user
- group
- mode
- makedirs: True
- require:
- cmd: postgresql-cluster-prepared