Defined Type: psick::services::init_script

Defined in:
manifests/services/init_script.pp

Overview

Define psick::services::init_script

This define manages the creation of a script under /etc/init.d and of the relevant service.

Parameters:

  • ensure (Enum['present','absent']) (defaults to: present)
  • source (Optional[String]) (defaults to: undef)
  • content (Optional[String]) (defaults to: undef)
  • template (Optional[String]) (defaults to: undef)
  • epp (Optional[String]) (defaults to: undef)
  • service_ensure (Optional[String]) (defaults to: undef)
  • service_enable (Variant[Undef,Boolean,String]) (defaults to: undef)


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
# File 'manifests/services/init_script.pp', line 6

define psick::services::init_script (
  Enum['present','absent'] $ensure = present,
  Optional[String] $source = undef,
  Optional[String] $content = undef,
  Optional[String] $template = undef,
  Optional[String] $epp = undef,
  Optional[String] $service_ensure = undef,
  Variant[Undef,Boolean,String] $service_enable = undef,
) {
  $manage_content = tp_content($content, $template, $epp)
  file { "/etc/init.d/${title}":
    ensure  => $ensure,
    content => $manage_content,
    source  => $source,
    mode    => '0755',
    owner   => 'root',
    group   => 'root',
  }
  if ($service_ensure or $service_enable)
  and $ensure == 'present' {
    service { $title:
      ensure    => $service_ensure,
      enable    => $service_enable,
      subscribe => File["/etc/init.d/${title}"],
    }
  }
}