summaryrefslogtreecommitdiff
path: root/manifests/managed_service.pp
blob: fdea55f0c4218b17819ce2d315cf4de78dc9b0db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
define s6::managed_service (
  String $runscript,
  String $service_dir = $s6::service_dir,
  String $scan_dir = $s6::scan_dir,
  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',
      ;
    }
  }
}