|
1 |
| -{%- from "postgres/map.jinja" import postgres with context -%} |
2 |
| -
|
3 |
| -{%- set pkgs = [postgres.pkg] + postgres.pkgs_extra -%} |
| 1 | +{%- from "postgres/map.jinja" import postgres with context %} |
4 | 2 |
|
| 3 | +{%- set includes = [] %} |
| 4 | +{%- if postgres.bake_image %} |
| 5 | + {%- do includes.append('postgres.server.image') %} |
| 6 | +{%- endif %} |
5 | 7 | {%- if postgres.use_upstream_repo -%}
|
| 8 | + {%- do includes.append('postgres.upstream') %} |
| 9 | +{%- endif %} |
| 10 | +
|
| 11 | +{%- set pkgs = [postgres.pkg] + postgres.pkgs_extra %} |
| 12 | +
|
| 13 | +{%- if includes -%} |
6 | 14 |
|
7 | 15 | include:
|
8 |
| - - postgres.upstream |
| 16 | + {{ includes|yaml(false)|indent(2) }} |
9 | 17 |
|
10 | 18 | {%- endif %}
|
11 | 19 |
|
@@ -36,6 +44,8 @@ postgresql-server:
|
36 | 44 | - onlyif: test -f {{ path }}
|
37 | 45 | - require:
|
38 | 46 | - pkg: postgresql-server
|
| 47 | + - require_in: |
| 48 | + - cmd: postgresql-cluster-prepared |
39 | 49 |
|
40 | 50 | {%- endfor %}
|
41 | 51 |
|
@@ -120,34 +130,4 @@ postgresql-running:
|
120 | 130 | - watch:
|
121 | 131 | - file: postgresql-pg_hba
|
122 | 132 |
|
123 |
| -{%- else %} |
124 |
| -
|
125 |
| -# An attempt to launch PostgreSQL with `pg_ctl` during an image preparation |
126 |
| -
|
127 |
| -postgresql-start: |
128 |
| - cmd.run: |
129 |
| - - name: pg_ctl -D {{ postgres.conf_dir }} -l logfile start |
130 |
| - - runas: {{ postgres.user }} |
131 |
| - - unless: |
132 |
| - - ps -p $(head -n 1 {{ postgres.conf_dir }}/postmaster.pid) 2>/dev/null |
133 |
| - - require: |
134 |
| - - file: postgresql-pg_hba |
135 |
| -
|
136 |
| -# Try to enable PostgreSQL in "manual" way when baking an image |
137 |
| -
|
138 |
| -postgresql-enable: |
139 |
| - cmd.run: |
140 |
| - {%- if salt['file.file_exists']('/bin/systemctl') %} |
141 |
| - - name: systemctl enable {{ postgres.service }} |
142 |
| - {%- elif salt['cmd.which']('chkconfig') %} |
143 |
| - - name: chkconfig {{ postgres.service }} on |
144 |
| - {%- elif salt['file.file_exists']('/usr/sbin/update-rc.d') %} |
145 |
| - - name: update-rc.d {{ service }} defaults |
146 |
| - {%- else %} |
147 |
| - # Nothing to do |
148 |
| - - name: 'true' |
149 |
| - {%- endif %} |
150 |
| - - require: |
151 |
| - - cmd: postgresql-start |
152 |
| -
|
153 | 133 | {%- endif %}
|
0 commit comments