From 2efcb90c159d49f56a12dd4d0e72abc542a491ed Mon Sep 17 00:00:00 2001 From: Hendrik Jäger Date: Fri, 10 May 2024 12:02:17 +0200 Subject: add mechanism to pass service definition --- manifests/managed_service.pp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 manifests/managed_service.pp (limited to 'manifests/managed_service.pp') diff --git a/manifests/managed_service.pp b/manifests/managed_service.pp new file mode 100644 index 0000000..4140f7b --- /dev/null +++ b/manifests/managed_service.pp @@ -0,0 +1,42 @@ +define s6::managed_service ( + String $service_dir, + String $scan_dir, + String $runscript, + Optional[String] $finishscript = undef, + Optional[String] $logger_runscript = undef, +) { + file { + "${service_dir}/${name}": + ensure => directory, + ; + "${service_dir}/${name}/run": + ensure => present, + content => $runscript, + mode => '0755', + ; + } + if $finishscript { + file { + "${service_dir}/${name}/finish": + ensure => present, + content => $finishscript, + mode => '0755', + ; + } + } + if $logger_runscript { + file { + "${service_dir}/var/log/s6/${name}": + ensure => directory, + ; + "${service_dir}/${name}/log": + ensure => directory, + ; + "${service_dir}/${name}/log/run": + ensure => present, + content => $logger_runscript, + mode => '0755', + ; + } + } +} -- cgit v1.2.3