From 0e52327c348def7ebf9ad7eb59dae5b461ab8d4a Mon Sep 17 00:00:00 2001 From: Julien Riou Date: Mon, 14 Dec 2020 11:23:51 +0100 Subject: [PATCH 1/2] Move systemd service unit to /etc Units in /lib should be deployed by packages. Files with customizations should be written to /etc. --- manifests/install.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index 94cdd63..594bb83 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -66,7 +66,7 @@ } } 'systemd' : { - file { '/lib/systemd/system/consul-template.service': + file { '/etc/systemd/system/consul-template.service': mode => '0644', owner => 'root', group => 'root', From 9dcd1ccb98d173cab356b4f5238ad228cfcc84d7 Mon Sep 17 00:00:00 2001 From: Julien Riou Date: Mon, 14 Dec 2020 11:35:37 +0100 Subject: [PATCH 2/2] Reload systemd daemon When a systemd unit is customized, the daemon has to be reloaded. --- manifests/install.pp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/manifests/install.pp b/manifests/install.pp index 594bb83..ef93480 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -71,6 +71,15 @@ owner => 'root', group => 'root', content => template('consul_template/consul-template.systemd.erb'), + notify => Exec['systemctl daemon-reload'], + } + if (!defined(Exec['systemctl daemon-reload'])) { + exec { 'systemctl daemon-reload': + command => 'systemctl daemon-reload', + path => '/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin', + refreshonly => true, + before => Service['consul-template'], + } } } 'sysv' : {