From 64635320a5f5db2a4eb028b8b8ea97af2bf6ddb7 Mon Sep 17 00:00:00 2001 From: Astro Date: Thu, 17 Nov 2016 15:35:39 +0100 Subject: [PATCH] automatic service restarting --- salt/dhcp/init.sls | 14 +++++++++----- salt/ospf/init.sls | 2 ++ salt/unbound/init.sls | 5 +++++ salt/vpn/openvpn.sls | 4 +++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/salt/dhcp/init.sls b/salt/dhcp/init.sls index 6b2b9ba..ad7b3c5 100644 --- a/salt/dhcp/init.sls +++ b/salt/dhcp/init.sls @@ -1,5 +1,7 @@ isc-dhcp-server: pkg.installed: [] + service: + - running /etc/dhcp/dhcpd.conf: file.managed: @@ -20,8 +22,10 @@ autostart-dhcpd: start-dhcpd: service.running: - - name: isc-dhcp-server - require_in: - - file: /etc/dhcp/dhcpd.conf - - file: /etc/default/isc-dhcp-server - + - name: isc-dhcp-server + require_in: + - file: /etc/dhcp/dhcpd.conf + - file: /etc/default/isc-dhcp-server + watch: + - pkg: isc-dhcp-server + - file: /etc/dhcp/dhcpd.conf diff --git a/salt/ospf/init.sls b/salt/ospf/init.sls index 0433978..3220d34 100644 --- a/salt/ospf/init.sls +++ b/salt/ospf/init.sls @@ -24,6 +24,8 @@ start-{{ daemon }}: - name: {{ daemon }} require: - service: autostart-{{ daemon }} + watch: + - file: /etc/quagga/{{ daemon }}.conf {%- endfor %} diff --git a/salt/unbound/init.sls b/salt/unbound/init.sls index b8f7e2d..6eb7bd7 100644 --- a/salt/unbound/init.sls +++ b/salt/unbound/init.sls @@ -1,5 +1,10 @@ unbound: pkg.installed: [] + service: + - running + - watch: + - pkg: unbound + - file: /etc/unbound/unbound.conf.d/listen.conf /etc/unbound/unbound.conf.d/listen.conf: file.managed: diff --git a/salt/vpn/openvpn.sls b/salt/vpn/openvpn.sls index 4111f4c..853e21a 100644 --- a/salt/vpn/openvpn.sls +++ b/salt/vpn/openvpn.sls @@ -65,8 +65,10 @@ start-{{ name }}: require_in: - file: /etc/openvpn/{{ name }}.conf - file: /etc/openvpn/{{ name }}.auth + watch: + - file: /etc/openvpn/{{ name }}.conf + - file: /etc/openvpn/{{ name }}.auth require: - file: /dev/net/tun {%- endfor %} -