summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Jäger <gitcommit@henk.geekmail.org>2024-05-10 12:02:17 +0200
committerHendrik Jäger <gitcommit@henk.geekmail.org>2024-05-10 12:02:17 +0200
commit2efcb90c159d49f56a12dd4d0e72abc542a491ed (patch)
tree63668097e022dcdd75e02dc3af7bd7b9f8b61749
parentd6cf224dab027f25cedff7a23597ccdc90e37af8 (diff)
add mechanism to pass service definition
-rw-r--r--manifests/managed_service.pp42
1 files changed, 42 insertions, 0 deletions
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',
+ ;
+ }
+ }
+}