Puppet Class: psick::systemd

Defined in:
manifests/systemd.pp

Overview

This profile allows triggering systemd commands once for all modules Based on github.com/voxpupuli/puppet-systemd module

Parameters:

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

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

  • unit_files (Hash[String[1],Hash[String[1], Any]]) (defaults to: {})

    Hash of ‘psick::systemd::unit_file` resources



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/systemd.pp', line 11

class psick::systemd (
  Optional[Pattern['^.+\.target$']]                   $default_target = undef,
  Hash[String[1],Hash[String[1], Any]]                $unit_files = {},

) {
  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'],
    }
  }

  $unit_files.each |$unit_file, $unit_file_data| {
    psick::systemd::unit_file { $unit_file:
      * => $unit_file_data,
    }
  }
}