Restarts needed services automatically. Installs package, configures mode (list, automatic, interactive). Adds groups of services to ignore list.
Once installed, needrestart hooks into package management and init systems. For example, upgrading openssl via apt will restart exim and apache if they have proper init scripts.
To automatically restart everything except bareos-fd, mysql, exim4, dovecot and apache2 if needed:
class { 'needrestart':
action => 'automatic',
ignorelist => {'Backups' => ['bareos-fd'],
'Databases' => ['mysql'],
'Mail' => ['exim4','dovecot'],
'Webservers' => ['apache2']},
}
}
Another hiera example:
---
classes:
- needrestart
needrestart::action: 'interactive'
needrestart::disable_kernel_hints: false
needrestart::notify_user_obsolete_binaries: true
needrestart::preferred_ui: 'debconf'
needrestart::ignorelist:
'Virtualization':
- 'libvirt-bin'
'Applications'
- 'tomcat8'
String to specify default action. Possible values are:
- list (default)
- interactive
- automatic
String to set preferred ui. Possible values are:
- stdio (default)
- debconf.
See example in usage above.
Boolean to specify if hints on pending kernel upgrades are hidden or not. Possible values are:
- true (default)
- false
Boolean to specify if a user is notified about obsolete binaries in his session or not. Possible values are:
- true (default)
- false
String for ensure parameter to the needrestart package. Default value is "installed".
String to specify the package name. Default value is "needrestart".
Only tested on Debian 7.0 and Ubuntu >= 14.04