aboutsummaryrefslogtreecommitdiff
path: root/manifests/unattended_upgrades.pp
diff options
context:
space:
mode:
Diffstat (limited to 'manifests/unattended_upgrades.pp')
-rw-r--r--manifests/unattended_upgrades.pp45
1 files changed, 23 insertions, 22 deletions
diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp
index 398a1a7..52d7542 100644
--- a/manifests/unattended_upgrades.pp
+++ b/manifests/unattended_upgrades.pp
@@ -1,33 +1,34 @@
-class apt::unattended_upgrades {
+class apt::unattended_upgrades (
+ $config_content = undef,
+ $config_template = 'apt/50unattended-upgrades.erb',
+ $mailonlyonerror = true,
+ $mail_recipient = 'root',
+ $blacklisted_packages = [],
+ $ensure_version = present
+) {
package { 'unattended-upgrades':
- ensure => present,
- require => undef
+ ensure => $ensure_version
}
- apt_conf { '50unattended-upgrades':
- source => [
- "puppet:///modules/site_apt/${::lsbdistid}/50unattended-upgrades.${::lsbdistcodename}",
- "puppet:///modules/site_apt/${::lsbdistid}/50unattended-upgrades",
- "puppet:///modules/apt/${::lsbdistid}/50unattended-upgrades.${::lsbdistcodename}",
- "puppet:///modules/apt/${::lsbdistid}/50unattended-upgrades" ],
+ # For some reason, this directory is sometimes absent, which causes
+ # unattended-upgrades to crash.
+ file { '/var/log/unattended-upgrades':
+ ensure => directory,
+ owner => 'root',
+ group => 0,
+ mode => '0755',
require => Package['unattended-upgrades'],
}
- if defined(File['apt_config']) {
- Apt_conf['50unattended-upgrades'] {
- before => File['apt_config'],
- }
+ $file_content = $config_content ? {
+ undef => template($config_template),
+ default => $config_content
}
- if $operatingsystem == 'ubuntu' {
- file { '/etc/apt/apt.conf.d/10periodic':
- ensure => present,
- owner => root,
- group => root,
- mode => 0644,
- source => 'puppet:///modules/apt/10periodic',
- require => Package['unattended-upgrades'],
- }
+ apt_conf { '50unattended-upgrades':
+ content => $file_content,
+ require => Package['unattended-upgrades'],
+ refresh_apt => false
}
}