From d2e5860205320d1b450cf2dd3ce35bc69524e453 Mon Sep 17 00:00:00 2001 From: Jason Rogena Date: Tue, 21 May 2019 18:37:18 +0300 Subject: [PATCH] Use pg_ctlcluster to reload config files Since the TravisCI deployments freeze-up when you use the Ansible service module to reload config files, use the pg_ctlcluster command to reload the configuration files. Fix suggested by @vladp https://github.com/ANXS/postgresql/pull/420. Signed-off-by: Jason Rogena --- tasks/configure.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tasks/configure.yml b/tasks/configure.yml index 8f5f696f..90ce1d43 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -217,8 +217,17 @@ mode: u=rwX,g=rwXs,o=rx notify: restart postgresql -- name: PostgreSQL | Reload all conf files - service: - name: "{{ postgresql_service_name }}" - state: reloaded +- block: + - name: PostgreSQL | Check if cluster is running + command: "pg_ctlcluster {{ postgresql_version }} {{ postgresql_cluster_name }} status" + ignore_errors: true + register: postgresql_cluster_running + + - name: PostgreSQL | Reload cluster + command: "pg_ctlcluster {{ postgresql_version }} {{ postgresql_cluster_name }} reload" + when: postgresql_cluster_running.rc == 0 + + - name: PostgreSQL | Start cluster + command: "pg_ctlcluster {{ postgresql_version }} {{ postgresql_cluster_name }} start" + when: postgresql_cluster_running.rc != 0 when: postgresql_configuration_pt1.changed or postgresql_configuration_pt2.changed or postgresql_configuration_pt3.changed or postgresql_systemd_custom_conf.changed