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

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

    Set the system time zone to the specified value. Available timezones can be listed with list-timezones. If the RTC is configured to be in the local time, this will also update the RTC time. This call will alter the /etc/localtime symlink.

  • set_local_rtc (Optional[Boolean]) (defaults to: undef)

    Takes a boolean argument. If “false”, the system is configured to maintain the RTC in universal time. If “true”, it will maintain the RTC in local time instead. Note that maintaining the RTC in the local timezone is not fully supported and will create various problems with time zone changes and daylight saving adjustments. If at all possible, keep the RTC in UTC mode.

  • 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_journal_upload (Boolean) (defaults to: false)

    Manage the systemd journal upload to a remote server

  • journal_upload_settings (Systemd::JournalUploadSettings) (defaults to: {})

    Config Hash that is used to configure settings in journal-upload.conf

  • manage_journal_remote (Boolean) (defaults to: false)

    Manage the systemd journal remote server used to upload journals

  • journal_remote_settings (Systemd::JournalRemoteSettings) (defaults to: {})

    Config Hash that is used to configure settings in journal-remote.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.

  • udev_reload (Boolean) (defaults to: false)

    Whether udev rules should be automatically reloaded upon change.

  • 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_package (Optional[String[1]]) (defaults to: undef)

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

  • 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

  • manage_system_conf (Boolean) (defaults to: false)

    Should system service manager configurations be managed

  • system_settings (Systemd::ServiceManagerSettings) (defaults to: {})

    Config Hash that is used to configure settings in system.conf NOTE: It’s currently impossible to have multiple entries of the same key in the settings.

  • manage_user_conf (Boolean) (defaults to: false)

    Should user service manager configurations be managed

  • user_settings (Systemd::ServiceManagerSettings) (defaults to: {})

    Config Hash that is used to configure settings in user.conf NOTE: It’s currently impossible to have multiple entries of the same key in the settings.



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
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'manifests/init.pp', line 253

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,
  Optional[Boolean]                                   $set_local_rtc = undef,
  Optional[String[1]]                                 $timezone = undef,
  Boolean                                             $manage_accounting = false,
  Boolean                                             $purge_dropin_dirs = true,
  Boolean                                             $manage_journald = true,
  Systemd::JournaldSettings                           $journald_settings = {},
  Boolean                                             $manage_journal_upload = false,
  Systemd::JournalUploadSettings                      $journal_upload_settings = {},
  Boolean                                             $manage_journal_remote = false,
  Systemd::JournalRemoteSettings                      $journal_remote_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                                             $udev_reload = false,
  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,
  Optional[String[1]]                                 $oomd_package = undef,
  Enum['stopped','running']                           $oomd_ensure = 'running',
  Systemd::OomdSettings                               $oomd_settings = {},
  Boolean                                             $udev_purge_rules = false,
  Boolean                                             $manage_system_conf = false,
  Systemd::ServiceManagerSettings                     $system_settings = {},
  Boolean                                             $manage_user_conf = false,
  Systemd::ServiceManagerSettings                     $user_settings = {},
) {
  contain systemd::install

  if $default_target {
    $target = stdlib::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']
  }

  contain systemd::timedatectl

  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
  }

  # $manage_accounting is retained for backward compatibility
  if $manage_accounting or $manage_system_conf or $manage_user_conf {
    contain systemd::service_manager
  }

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

  if $manage_journald {
    contain systemd::journald
  }

  if $manage_journal_upload {
    contain systemd::journal_upload
  }

  if $manage_journal_remote {
    contain systemd::journal_remote
  }

  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,
    }
  }
}