From 4f369cc114bf35af4c8c37ffcee69d1b7442e93f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= <hugo@lysator.liu.se> Date: Tue, 9 May 2023 17:36:20 +0200 Subject: [PATCH] exec 5.old. --- manifests/user_instance.pp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/manifests/user_instance.pp b/manifests/user_instance.pp index 50845f3..f5a0735 100644 --- a/manifests/user_instance.pp +++ b/manifests/user_instance.pp @@ -21,6 +21,8 @@ # Should the config_dir be managed by us. # @param mpd_conf # Settings passed along to mpd::conf +# @param service_name +# Name of the user (system) service define mpd::user_instance ( String $user = $name, String $group = $user, @@ -30,6 +32,7 @@ define mpd::user_instance ( String $config_file = "${config_dir}/mpd.conf", Boolean $manage_dir = true, Hash[String, Any] $mpd_conf = {}, + String $service_name = 'mpd', ) { if $manage_dir { file { $config_dir: @@ -51,14 +54,14 @@ define mpd::user_instance ( } ~> Exec["Restart user ${user} mpd instance"] exec { "Enable user ${user} mpd instance": - command => 'systemctl enable --now --user mpd.service'.split(' '), + command => "systemctl enable --now --user ${service_name}", creates => "${xdg_config_home}/systemd/user/default.target.wants/mpd.service", user => $user, path => ['/bin', '/usr/bin'], } exec { "Restart user ${user} mpd instance": - command => 'systemctl restart --user mpd.service'.split(' '), + command => "systemctl restart --user ${service_name}", refreshonly => true, path => ['/bin', '/usr/bin'], } -- GitLab