Puppet Class: needrestart

Inherits:
needrestart::params
Inherited by:
needrestart::install
Defined in:
manifests/init.pp

Overview

main class for needrestart

Parameters: [configs] hash of configuration parameters to overwrite from default. Example (hiera): needrestart::configs: ui_mode: 'a' restart: 'l' defno: 0 blacklist: - 'qr(^/usr/bin/sudo(.dpkg-new)?$)' - 'qr(^/sbin/(dhclient|dhcpcd5|pump|udhcpc)(.dpkg-new)?$)' override_rc: 'qr(^dbus)': 0 'qr(^gdm)': 0

Parameters:

  • configs (Hash) (defaults to: {})
  • package_ensure (Any) (defaults to: $needrestart::params::package_ensure)
  • package_name (Any) (defaults to: $needrestart::params::package_name)


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'manifests/init.pp', line 17

class needrestart(
  Hash $configs                  = {},
  $package_ensure                = $needrestart::params::package_ensure,
  $package_name                  = $needrestart::params::package_name,
) inherits needrestart::params {

  $install = false

  case $::operatingsystem {
    'Debian': {
      $_install = true
    }

    'Ubuntu': {
      if versioncmp($::lsbdistrelease, '16.04') >= 0 {
        $_install = true
      }
    }

    default: {
        $_install = $install
      notice ("Your operating system ${::operatingsystem} is not supported by this module")
    }
  }

  if $_install {
    include needrestart::install

    file {'/etc/needrestart/conf.d/':
      ensure  => 'directory',
      owner   => 'root',
      group   => 'root',
      mode    => '0755',
      require => Class['needrestart::install'],
      purge   => true,
      recurse => true,
    }

    unless $configs == {} {
      class { 'needrestart::config':
        config_overrides => $configs,
      }
    }
  }
}