From 75358e03e05c16c694983c5c541be0dc1584ab9b Mon Sep 17 00:00:00 2001 From: Alexander Weidinger Date: Thu, 25 Jul 2019 22:15:55 +0200 Subject: [PATCH] fix(service): restart service on package change This also provides an ID to be used in a watch_in statement. --- postfix/init.sls | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/postfix/init.sls b/postfix/init.sls index cbed87d..6a8321d 100644 --- a/postfix/init.sls +++ b/postfix/init.sls @@ -17,6 +17,16 @@ postfix: - watch: - pkg: postfix +{%- if salt['pillar.get']('postfix:reload_service', True) %} +# Restart postfix if the package was changed. +# This also provides an ID to be used in a watch_in statement. +postfix_service_restart: + service.running: + - name: postfix + - watch: + - pkg: postfix +{%- endif %} + {# Used for newaliases, postalias and postconf #} {%- set default_database_type = salt['pillar.get']('postfix:config:default_database_type', 'hash') %}