Move module service.restart to EOF and convert to service.reload
* Simplify server restart/reload logic with respect to `MacOS` * Discussion in GitHub PR #250
This commit is contained in:
@@ -84,7 +84,7 @@ postgresql-cluster-prepared:
|
|||||||
- pkg: postgresql-server
|
- pkg: postgresql-server
|
||||||
- file: postgresql-cluster-prepared
|
- file: postgresql-cluster-prepared
|
||||||
- watch_in:
|
- watch_in:
|
||||||
- module: postgresql-service-restart
|
- service: postgresql-running
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
postgresql-config-dir:
|
postgresql-config-dir:
|
||||||
@@ -143,7 +143,7 @@ postgresql-conf:
|
|||||||
- file: postgresql-conf-comment-port
|
- file: postgresql-conf-comment-port
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
- watch_in:
|
- watch_in:
|
||||||
- module: postgresql-service-restart
|
- service: postgresql-running
|
||||||
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|
||||||
@@ -174,14 +174,7 @@ postgresql-pg_hba:
|
|||||||
- require:
|
- require:
|
||||||
- file: postgresql-config-dir
|
- file: postgresql-config-dir
|
||||||
- watch_in:
|
- watch_in:
|
||||||
- module: postgresql-service-restart
|
- service: postgresql-running
|
||||||
|
|
||||||
# Restart the service where reloading is not sufficient
|
|
||||||
# Currently when the cluster is created or changes made to `postgresql.conf`
|
|
||||||
postgresql-service-restart:
|
|
||||||
module.wait:
|
|
||||||
- name: service.restart
|
|
||||||
- m_name: {{ postgres.service }}
|
|
||||||
|
|
||||||
{%- set pg_ident_path = salt['file.join'](postgres.conf_dir, 'pg_ident.conf') %}
|
{%- set pg_ident_path = salt['file.join'](postgres.conf_dir, 'pg_ident.conf') %}
|
||||||
|
|
||||||
@@ -214,6 +207,12 @@ postgresql-pg_ident:
|
|||||||
{%- else %}
|
{%- else %}
|
||||||
- file: postgresql-cluster-prepared
|
- file: postgresql-cluster-prepared
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
- watch_in:
|
||||||
|
{%- if grains.os not in ('MacOS',) %}
|
||||||
|
- module: postgresql-service-reload
|
||||||
|
{%- else %}
|
||||||
|
- service: postgresql-running
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
{%- for name, tblspace in postgres.tablespaces|dictsort() %}
|
{%- for name, tblspace in postgres.tablespaces|dictsort() %}
|
||||||
|
|
||||||
@@ -258,15 +257,22 @@ postgresql-tablespace-dir-{{ name }}-fcontext:
|
|||||||
{%- if not postgres.bake_image %}
|
{%- if not postgres.bake_image %}
|
||||||
|
|
||||||
# Start PostgreSQL server using OS init
|
# Start PostgreSQL server using OS init
|
||||||
|
# Note: This is also the target for numerous `watch_in` requisites above, used
|
||||||
|
# for the necessary service restart after changing the relevant configuration files
|
||||||
postgresql-running:
|
postgresql-running:
|
||||||
service.running:
|
service.running:
|
||||||
- name: {{ postgres.service }}
|
- name: {{ postgres.service }}
|
||||||
- enable: True
|
- enable: True
|
||||||
{% if grains.os not in ('MacOS',) %}
|
|
||||||
- reload: True
|
# Reload the service for changes made to `pg_ident.conf`, except for `MacOS`
|
||||||
{% endif %}
|
# which is handled by `postgresql-running` above.
|
||||||
- watch:
|
{%- if grains.os not in ('MacOS',) %}
|
||||||
- file: postgresql-pg_hba
|
postgresql-service-reload:
|
||||||
- file: postgresql-pg_ident
|
module.wait:
|
||||||
|
- name: service.reload
|
||||||
|
- m_name: {{ postgres.service }}
|
||||||
|
- require:
|
||||||
|
- service: postgresql-running
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user