Skip to content

Commit 96613d7

Browse files
authored
Merge pull request Demonware#3 from onaio/travisci-build
Use pg_ctlcluster to Reload Config Files
2 parents e3f22bf + d2e5860 commit 96613d7

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

tasks/configure.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,17 @@
217217
mode: u=rwX,g=rwXs,o=rx
218218
notify: restart postgresql
219219

220-
- name: PostgreSQL | Reload all conf files
221-
service:
222-
name: "{{ postgresql_service_name }}"
223-
state: reloaded
220+
- block:
221+
- name: PostgreSQL | Check if cluster is running
222+
command: "pg_ctlcluster {{ postgresql_version }} {{ postgresql_cluster_name }} status"
223+
ignore_errors: true
224+
register: postgresql_cluster_running
225+
226+
- name: PostgreSQL | Reload cluster
227+
command: "pg_ctlcluster {{ postgresql_version }} {{ postgresql_cluster_name }} reload"
228+
when: postgresql_cluster_running.rc == 0
229+
230+
- name: PostgreSQL | Start cluster
231+
command: "pg_ctlcluster {{ postgresql_version }} {{ postgresql_cluster_name }} start"
232+
when: postgresql_cluster_running.rc != 0
224233
when: postgresql_configuration_pt1.changed or postgresql_configuration_pt2.changed or postgresql_configuration_pt3.changed or postgresql_systemd_custom_conf.changed

0 commit comments

Comments
 (0)