Puppet Class: systemd::networkd

Defined in:
manifests/networkd.pp

Summary

This class provides an abstract way to trigger systemd-networkd

Overview

Parameters:

  • ensure (Enum['stopped','running']) (defaults to: $systemd::networkd_ensure)

    The state that the “networkd“ service should be in

  • path (Stdlib::Absolutepath) (defaults to: $systemd::network_path)

    path where all networkd files are placed in

  • manage_all_network_files (Boolean) (defaults to: $systemd::manage_all_network_files)

    if enabled, all networkd files that aren’t managed by puppet will be purged



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
# File 'manifests/networkd.pp', line 8

class systemd::networkd (
  Enum['stopped','running'] $ensure = $systemd::networkd_ensure,
  Stdlib::Absolutepath $path = $systemd::network_path,
  Boolean $manage_all_network_files = $systemd::manage_all_network_files,
) {
  assert_private()

  $_enable_networkd = $ensure ? {
    'stopped' => false,
    'running' => true,
    default   => $ensure,
  }

  service { 'systemd-networkd':
    ensure => $ensure,
    enable => $_enable_networkd,
  }
  # this directory is created by systemd
  # we define it here to purge non-managed files
  if $manage_all_network_files {
    file { $path:
      ensure  => 'directory',
      recurse => true,
      purge   => true,
      notify  => Service['systemd-networkd'],
    }
  }
}