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
|
class networking::networkd (
Boolean $notify_ = true,
Boolean $manage_directory = true,
String $path = '/etc/systemd/network',
) {
if $manage_directory {
file { $path:
ensure => directory,
purge => true,
recurse => true,
}
}
# Force a full restort of systemd networkd to reload all configuration.
# The alternative is to first run `networkctl reload` which reloads
# network files, followed by a `networkctl reconfigure <iface>`.
#
# When this was writen, I didn't realize that a reload +
# reconfigure was required. Note that old configurations might
# lingerif done that way.
if $notify_ {
exec { 'reload networkd':
command => 'systemctl reload-or-restart systemd-networkd',
path => ['/bin', '/usr/bin',],
refreshonly => true,
}
}
service { 'systemd-networkd':
ensure => running,
enable => true,
}
}
|