summaryrefslogtreecommitdiff
path: root/manifests/networkd.pp
blob: 7c06b58579d18025d04ce6d3d1b9de13b112c703 (plain)
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
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,
    }
  }

  # Why this instead of `networkctl reload`?
  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,
  }
}