diff --git a/manifests/user_instance.pp b/manifests/user_instance.pp index 50845f314cee7673d91599ce0277fc9912b2ebf0..f5a0735051c5365d7ef455d83387f702363d351c 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'], }