Defined Type: psick::services::systemd_script
- Defined in:
- manifests/services/systemd_script.pp
Overview
Define psick::services::systemd_script
This define manages the creation of a systemd script and of the relevant service.
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 43 |
# File 'manifests/services/systemd_script.pp', line 6
define psick::services::systemd_script (
Enum['present','absent'] $ensure = present,
Optional[String] $source = undef,
Optional[String] $content = undef,
Optional[String] $template = undef,
Optional[String] $epp = undef,
String $path = "/usr/local/sbin/${title}",
Optional[String] $service_ensure = undef,
Variant[Undef,Boolean,String] $service_enable = undef,
String $systemd_template = 'psick/services/systemd.erb',
Optional[String] $systemd_after = 'network.target', # lint:ignore:optional_default
Optional[String] $systemd_before = undef,
) {
$manage_content = tp_content($content, $template, $epp)
file { $path:
ensure => $ensure,
content => $manage_content,
source => $source,
mode => '0755',
owner => 'root',
group => 'root',
}
file { "/etc/systemd/system/${title}.service":
ensure => $ensure,
content => template($systemd_template),
mode => '0644',
owner => 'root',
group => 'root',
}
if ($service_ensure or $service_enable)
and $ensure == 'present' {
service { $title:
ensure => $service_ensure,
enable => $service_enable,
subscribe => [File["/etc/systemd/system/${title}.service"],File[$path]],
}
}
}
|