Puppet Class: systemd::service_manager
- Defined in:
- manifests/service_manager.pp
Overview
This class provides a solution to manage system and/or user service manager settings
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'manifests/service_manager.pp', line 31
class systemd::service_manager (
Boolean $manage_accounting = $systemd::manage_accounting,
Boolean $manage_system_conf = $systemd::manage_system_conf,
Boolean $manage_user_conf = $systemd::manage_user_conf,
Systemd::ServiceManagerSettings $accounting_settings = $systemd::accounting,
Systemd::ServiceManagerSettings $system_settings = $systemd::system_settings,
Systemd::ServiceManagerSettings $user_settings = $systemd::user_settings,
) {
assert_private()
$real_system_settings = case [$manage_accounting, $manage_system_conf] {
[true, false]: { $accounting_settings }
[false, true]: { $system_settings }
[true, true]: { $system_settings + $accounting_settings } # Accounting settings have preference
default: { ({}) } # Empty Hash otherwise
}
# Manager config takes effect on daemon-reexec.
unless empty($real_system_settings) {
ensure_resource('systemd::daemon_reexec', 'system.conf')
}
$real_system_settings.each |$option, $value| {
$vh = $value ? {
Systemd::SettingEnsure => $value,
default => { value => $value },
}
ini_setting { "system/${option}":
ensure => $vh.get('ensure', 'present'),
path => '/etc/systemd/system.conf',
section => 'Manager',
setting => $option,
value => $vh['value'],
notify => Systemd::Daemon_reexec['system.conf'],
}
}
if $manage_user_conf {
unless empty($user_settings) {
ensure_resource('systemd::daemon_reexec', 'user.conf')
}
$user_settings.each |$option, $value| {
$vh = $value ? {
Systemd::SettingEnsure => $value,
default => { value => $value },
}
ini_setting { "user/${option}":
ensure => $vh.get('ensure', 'present'),
path => '/etc/systemd/user.conf',
section => 'Manager',
setting => $option,
value => $vh['value'],
notify => Systemd::Daemon_reexec['user.conf'],
}
}
}
}
|