30
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
|
# File 'manifests/daemon_reload.pp', line 30
define systemd::daemon_reload (
Boolean $enable = true,
Optional[String[1]] $user = undef,
) {
include systemd
if $enable {
if $user {
if ($facts['os']['family'] == 'RedHat' and versioncmp($facts['os']['release']['major'],'9') < 0 ) or
($facts['os']['name'] == 'Debian' and versioncmp($facts['os']['release']['major'],'12') < 0 ) or
($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'],'22.04') < 0 ) {
fail('systemd::daemon_reload_for a user is not supported below RedHat 9, Debian 12 or Ubuntu 22.04')
}
$_title = "${module_name}-${name}-systemctl-user-${user}-daemon-reload"
$_command = ['systemd-run', '--pipe', '--wait', '--user', '--machine', "${user}@.host", 'systemctl', '--user', 'daemon-reload']
} else {
$_title = "${module_name}-${name}-systemctl-daemon-reload"
$_command = ['systemctl', 'daemon-reload']
}
exec { $_title:
command => $_command,
refreshonly => true,
path => $facts['path'],
}
}
}
|