Puppet Class: systemd

Defined in:
manifests/init.pp

Overview

This module allows triggering systemd commands once for all modules

Parameters:

  • default_target (Optional[Pattern['^.+\.target$']]) (defaults to: undef)

    The default systemd boot target, unmanaged if set to undef.

  • service_limits (Stdlib::CreateResources) (defaults to: {})

    Deprecated, use dropin_files - Hash of ‘systemd::service_limits` resources

  • networks (Stdlib::CreateResources) (defaults to: {})

    Hash of ‘systemd::network` resources

  • timers (Stdlib::CreateResources) (defaults to: {})

    Hash of ‘systemd::timer` resources

  • tmpfiles (Stdlib::CreateResources) (defaults to: {})

    Hash of ‘systemd::tmpfile` resources

  • unit_files (Stdlib::CreateResources) (defaults to: {})

    Hash of ‘systemd::unit_file` resources

  • manage_resolved (Boolean) (defaults to: false)

    Manage the systemd resolver

  • resolved_ensure (Enum['stopped','running']) (defaults to: 'running')

    The state that the “resolved“ service should be in. When migrating from ‘running’ to ‘stopped’ an attempt will be made to restore a working ‘/etc/resolv.conf` using `/run/systemd/resolve/resolv.conf`.

  • resolved_package (Optional[Enum['systemd-resolved']]) (defaults to: undef)

    The name of a systemd sub package needed for systemd-resolved if one needs to be installed.

  • manage_nspawn (Boolean) (defaults to: false)

    Manage the systemd-nspawn@service and machinectl subsystem.

  • nspawn_package (Optional[Enum['systemd-container']]) (defaults to: undef)

    The name of a systemd sub package needed for the nspawn tools machinectl and systemd-nspawn if one needs to be installed.

  • dns (Optional[Variant[Array[String],String]]) (defaults to: undef)

    A space-separated list of IPv4 and IPv6 addresses to use as system DNS servers. DNS requests are sent to one of the listed DNS servers in parallel to suitable per-link DNS servers acquired from systemd-networkd.service(8) or set at runtime by external applications. requires puppetlabs-inifile

  • fallback_dns (Optional[Variant[Array[String],String]]) (defaults to: undef)

    A space-separated list of IPv4 and IPv6 addresses to use as the fallback DNS servers. Any per-link DNS servers obtained from systemd-networkd take precedence over this setting. requires puppetlabs-inifile

  • domains (Optional[Variant[Array[String],String]]) (defaults to: undef)

    A space-separated list of domains host names or IP addresses to be used systemd-resolved take precedence over this setting.

  • llmnr (Optional[Variant[Boolean,Enum['resolve']]]) (defaults to: undef)

    Takes a boolean argument or “resolve”.

  • multicast_dns (Optional[Variant[Boolean,Enum['resolve']]]) (defaults to: undef)

    Takes a boolean argument or “resolve”.

  • dnssec (Optional[Variant[Boolean,Enum['allow-downgrade']]]) (defaults to: undef)

    Takes a boolean argument or “allow-downgrade”.

  • dnsovertls (Variant[Boolean,Enum['yes', 'opportunistic', 'no']]) (defaults to: false)

    Takes a boolean argument or one of “yes”, “opportunistic” or “no”. “true” corresponds to “opportunistic” and “false” (default) to “no”.

  • cache (Optional[Variant[Boolean,Enum['no-negative']]]) (defaults to: undef)

    Takes a boolean argument or “no-negative”. If left ‘undef` the cache setting will not be modified.

  • dns_stub_listener (Optional[Variant[Boolean,Enum['udp','tcp','absent']]]) (defaults to: undef)

    Takes a boolean argument or one of “udp” and “tcp”. Setting it to ‘’absent’‘ will remove `DNSStubListener` existing entries from the configuration file

  • dns_stub_listener_extra (Optional[Variant[Array[String[1]],Enum['absent']]]) (defaults to: undef)

    Additional addresses for the DNS stub listener to listen on Setting it to ‘’absent’‘ will remove `DNSStubListenerExtra` existing entries from the configuration file

  • manage_resolv_conf (Boolean) (defaults to: true)

    For when ‘manage_resolved` is `true` should the file `/etc/resolv.conf` be managed.

  • use_stub_resolver (Boolean) (defaults to: false)

    Takes a boolean argument. When “false” (default) it uses /run/systemd/resolve/resolv.conf as /etc/resolv.conf. When “true”, it uses /run/systemd/resolve/stub-resolv.conf When ‘resolved_ensure` is `stopped` this parameter is ignored.

  • manage_networkd (Boolean) (defaults to: false)

    Manage the systemd network daemon

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

    The state that the “networkd“ service should be in

  • networkd_package (Optional[String[1]]) (defaults to: undef)

    Name of the package required for systemd-networkd, if any

  • manage_timesyncd (Boolean) (defaults to: false)

    Manage the systemd timesyncd daemon

  • timesyncd_ensure (Enum['stopped','running']) (defaults to: 'running')

    The state that the “timesyncd“ service should be in

  • timesyncd_package (Optional[String[1]]) (defaults to: undef)

    Name of the package required for systemd-timesyncd, if any

  • ntp_server (Optional[Variant[Array,String]]) (defaults to: undef)

    comma separated list of ntp servers, will be combined with interface specific addresses from systemd-networkd. requires puppetlabs-inifile

  • fallback_ntp_server (Optional[Variant[Array,String]]) (defaults to: undef)

    A space-separated list of NTP server host names or IP addresses to be used as the fallback NTP servers. Any per-interface NTP servers obtained from systemd-networkd take precedence over this setting. requires puppetlabs-inifile

  • manage_journald (Boolean) (defaults to: true)

    Manage the systemd journald

  • journald_settings (Systemd::JournaldSettings) (defaults to: {})

    Config Hash that is used to configure settings in journald.conf

  • manage_udevd (Boolean) (defaults to: false)

    Manage the systemd udev daemon

  • udev_log (Optional[Variant[Integer,String]]) (defaults to: undef)

    The value of /etc/udev/udev.conf udev_log

  • udev_children_max (Optional[Integer]) (defaults to: undef)

    The value of /etc/udev/udev.conf children_max

  • udev_exec_delay (Optional[Integer]) (defaults to: undef)

    The value of /etc/udev/udev.conf exec_delay

  • udev_event_timeout (Optional[Integer]) (defaults to: undef)

    The value of /etc/udev/udev.conf event_timeout

  • udev_resolve_names (Optional[Enum['early', 'late', 'never']]) (defaults to: undef)

    The value of /etc/udev/udev.conf resolve_names

  • udev_timeout_signal (Optional[Variant[Integer,String]]) (defaults to: undef)

    The value of /etc/udev/udev.conf timeout_signal

  • udev_rules (Stdlib::CreateResources) (defaults to: {})

    Config Hash that is used to generate instances of our ‘udev::rule` define.

  • machine_info_settings (Systemd::MachineInfoSettings) (defaults to: {})

    Settings to place into /etc/machine-info (hostnamectl)

  • manage_logind (Boolean) (defaults to: false)

    Manage the systemd logind

  • logind_settings (Systemd::LogindSettings) (defaults to: {})

    Config Hash that is used to configure settings in logind.conf

  • loginctl_users (Stdlib::CreateResources) (defaults to: {})

    Config Hash that is used to generate instances of our type ‘loginctl_user`.

  • dropin_files (Stdlib::CreateResources) (defaults to: {})

    Configure dropin files via hiera and ‘systemd::dropin_file` with factory pattern

  • manage_units (Stdlib::CreateResources) (defaults to: {})

    Configure units via hiera and ‘systemd::manage_unit` with factory pattern

  • manage_dropins (Stdlib::CreateResources) (defaults to: {})

    Configure dropin files via hiera and ‘systemd::manage_dropin` with factory pattern

  • manage_all_network_files (Boolean) (defaults to: false)
  • network_path (Stdlib::Absolutepath) (defaults to: '/etc/systemd/network')

    where all networkd files are placed in

  • manage_accounting (Boolean) (defaults to: false)

    when enabled, the different accounting options (network traffic, IO, CPU util…) are enabled for units

  • accounting (Hash[String,String]) (defaults to: {})

    Hash of the different accounting options. This highly depends on the used systemd version. The module provides sane defaults per operating system using Hiera.

  • purge_dropin_dirs (Boolean) (defaults to: true)

    When enabled, unused directories for dropin files will be purged

  • manage_coredump (Boolean) (defaults to: false)

    Should systemd-coredump configuration be managed

  • coredump_settings (Systemd::CoredumpSettings) (defaults to: {})

    Hash of systemd-coredump configurations for coredump.conf

  • coredump_backtrace (Boolean) (defaults to: false)

    Add –backtrace to systemd-coredump call systemd-coredump@.service unit

  • manage_oomd (Boolean) (defaults to: false)

    Should systemd-oomd configuration be managed

  • oomd_ensure (Enum['stopped','running']) (defaults to: 'running')

    The state that the “oomd“ service should be in

  • oomd_settings (Systemd::OomdSettings) (defaults to: {})

    Hash of systemd-oomd configurations for oomd.conf

  • udev_purge_rules (Boolean) (defaults to: false)

    Toggle if unmanaged files in /etc/udev/rules.d should be purged if manage_udevd is enabled



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'manifests/init.pp', line 202

class systemd (
  Optional[Pattern['^.+\.target$']]                   $default_target = undef,
  Hash[String,String]                                 $accounting = {},
  Stdlib::CreateResources                             $service_limits = {},
  Stdlib::CreateResources                             $networks = {},
  Stdlib::CreateResources                             $timers = {},
  Stdlib::CreateResources                             $tmpfiles = {},
  Stdlib::CreateResources                             $unit_files = {},
  Boolean                                             $manage_resolved = false,
  Optional[Enum['systemd-resolved']]                  $resolved_package = undef,
  Enum['stopped','running']                           $resolved_ensure = 'running',
  Optional[Variant[Array[String],String]]             $dns = undef,
  Optional[Variant[Array[String],String]]             $fallback_dns = undef,
  Optional[Variant[Array[String],String]]             $domains = undef,
  Optional[Variant[Boolean,Enum['resolve']]]          $llmnr = undef,
  Optional[Variant[Boolean,Enum['resolve']]]          $multicast_dns = undef,
  Optional[Variant[Boolean,Enum['allow-downgrade']]]  $dnssec = undef,
  Variant[Boolean,Enum['yes', 'opportunistic', 'no']] $dnsovertls = false,
  Optional[Variant[Boolean,Enum['no-negative']]]      $cache = undef,
  Optional[Variant[Boolean,Enum['udp','tcp','absent']]]  $dns_stub_listener = undef,
  Optional[Variant[Array[String[1]],Enum['absent']]] $dns_stub_listener_extra = undef,
  Boolean                                             $manage_resolv_conf = true,
  Boolean                                             $use_stub_resolver = false,
  Boolean                                             $manage_networkd = false,
  Enum['stopped','running']                           $networkd_ensure = 'running',
  Optional[String[1]]                                 $networkd_package = undef,
  Boolean                                             $manage_timesyncd = false,
  Enum['stopped','running']                           $timesyncd_ensure = 'running',
  Optional[String[1]]                                 $timesyncd_package = undef,
  Optional[Variant[Array,String]]                     $ntp_server = undef,
  Optional[Variant[Array,String]]                     $fallback_ntp_server = undef,
  Boolean                                             $manage_accounting = false,
  Boolean                                             $purge_dropin_dirs = true,
  Boolean                                             $manage_journald = true,
  Systemd::JournaldSettings                           $journald_settings = {},
  Systemd::MachineInfoSettings                        $machine_info_settings = {},
  Boolean                                             $manage_udevd = false,
  Optional[Variant[Integer,String]]                   $udev_log = undef,
  Optional[Integer]                                   $udev_children_max = undef,
  Optional[Integer]                                   $udev_exec_delay = undef,
  Optional[Integer]                                   $udev_event_timeout = undef,
  Optional[Enum['early', 'late', 'never']]            $udev_resolve_names = undef,
  Optional[Variant[Integer,String]]                   $udev_timeout_signal = undef,
  Boolean                                             $manage_logind = false,
  Systemd::LogindSettings                             $logind_settings = {},
  Boolean                                             $manage_all_network_files = false,
  Stdlib::Absolutepath                                $network_path = '/etc/systemd/network',
  Stdlib::CreateResources                             $loginctl_users = {},
  Stdlib::CreateResources                             $dropin_files = {},
  Stdlib::CreateResources                             $manage_units = {},
  Stdlib::CreateResources                             $manage_dropins = {},
  Stdlib::CreateResources                             $udev_rules = {},
  Boolean                                             $manage_coredump = false,
  Boolean                                             $manage_nspawn = false,
  Optional[Enum['systemd-container']]                 $nspawn_package = undef,
  Systemd::CoredumpSettings                           $coredump_settings = {},
  Boolean                                             $coredump_backtrace = false,
  Boolean                                             $manage_oomd = false,
  Enum['stopped','running']                           $oomd_ensure = 'running',
  Systemd::OomdSettings                               $oomd_settings = {},
  Boolean                                             $udev_purge_rules = false,
) {
  contain systemd::install

  if $default_target {
    $target = shell_escape($default_target)
    service { $target:
      ensure => 'running',
      enable => true,
    }

    exec { "systemctl set-default ${target}":
      command => "systemctl set-default ${target}",
      unless  => "test $(systemctl get-default) = ${target}",
      path    => $facts['path'],
    }
  }

  $service_limits.each |$service_limit, $service_limit_data| {
    systemd::service_limits { $service_limit:
      * => $service_limit_data,
    }
  }
  $networks.each |$network, $network_data| {
    systemd::network { $network:
      * => $network_data,
    }
  }
  $timers.each |$timer, $timer_data| {
    systemd::timer { $timer:
      * => $timer_data,
    }
  }
  $tmpfiles.each |$tmpfile, $tmpfile_data| {
    systemd::tmpfile { $tmpfile:
      * => $tmpfile_data,
    }
  }
  $unit_files.each |$unit_file, $unit_file_data| {
    systemd::unit_file { $unit_file:
      * => $unit_file_data,
    }
  }

  if $manage_resolved and $facts['systemd_internal_services'] and $facts['systemd_internal_services']['systemd-resolved.service'] {
    contain systemd::resolved
    Class['systemd::install'] -> Class['systemd::resolved']
  }

  if $manage_networkd and $facts['systemd_internal_services'] and $facts['systemd_internal_services']['systemd-networkd.service'] {
    contain systemd::networkd
    Class['systemd::install'] -> Class['systemd::networkd']
  }

  if $manage_timesyncd and $facts['systemd_internal_services'] and $facts['systemd_internal_services']['systemd-timesyncd.service'] {
    contain systemd::timesyncd
  }

  if $manage_udevd {
    contain systemd::udevd
  }

  if $manage_accounting {
    contain systemd::system
  }

  unless empty($machine_info_settings) {
    contain systemd::machine_info
  }

  if $manage_journald {
    contain systemd::journald
  }

  if $manage_logind {
    contain systemd::logind
  }

  if $manage_coredump {
    contain systemd::coredump
  }

  if $manage_oomd {
    contain systemd::oomd
  }

  $dropin_files.each |$name, $resource| {
    systemd::dropin_file { $name:
      * => $resource,
    }
  }

  $manage_units.each |$name, $resource| {
    systemd::manage_unit { $name:
      * => $resource,
    }
  }

  $manage_dropins.each |$name, $resource| {
    systemd::manage_dropin { $name:
      * => $resource,
    }
  }
}