Puppet Class: apt::unattended_upgrades

Inherits:
::apt::params
Defined in:
manifests/unattended_upgrades.pp

Overview

Class: apt::unattended_upgrades

This class manages the unattended-upgrades package and related configuration files for ubuntu

origins are the repositories to automatically upgrade included packages blacklist is a list of packages to not automatically upgrade update is how often to run “apt-get update” in days download is how often to run “apt-get upgrade –download-only” in days upgrade is how often to upgrade packages included in the origins list in days autoclean is how often to run “apt-get autoclean” in days

information on the other options can be found in the 50unattended-upgrades file and in /etc/cron.daily/apt

Parameters:

  • legacy_origin (Any) (defaults to: $::apt::params::legacy_origin)
  • origins (Any) (defaults to: $::apt::params::origins)
  • blacklist (Any) (defaults to: [])
  • update (Any) (defaults to: '1')
  • download (Any) (defaults to: '1')
  • upgrade (Any) (defaults to: '1')
  • autoclean (Any) (defaults to: '7')
  • auto_fix (Any) (defaults to: true)
  • minimal_steps (Any) (defaults to: false)
  • install_on_shutdown (Any) (defaults to: false)
  • mail_to (Any) (defaults to: 'NONE')
  • mail_only_on_error (Any) (defaults to: false)
  • remove_unused (Any) (defaults to: true)
  • auto_reboot (Any) (defaults to: false)
  • dl_limit (Any) (defaults to: 'NONE')
  • randomsleep (Any) (defaults to: undef)
  • enable (Any) (defaults to: '1')
  • backup_interval (Any) (defaults to: '0')
  • backup_level (Any) (defaults to: '3')
  • max_age (Any) (defaults to: '0')
  • min_age (Any) (defaults to: '0')
  • max_size (Any) (defaults to: '0')
  • download_delta (Any) (defaults to: '0')
  • verbose (Any) (defaults to: '0')


16
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'manifests/unattended_upgrades.pp', line 16

class apt::unattended_upgrades (
  $legacy_origin       = $::apt::params::legacy_origin,
  $origins             = $::apt::params::origins,
  $blacklist           = [],
  $update              = '1',
  $download            = '1',
  $upgrade             = '1',
  $autoclean           = '7',
  $auto_fix            = true,
  $minimal_steps       = false,
  $install_on_shutdown = false,
  $mail_to             = 'NONE',
  $mail_only_on_error  = false,
  $remove_unused       = true,
  $auto_reboot         = false,
  $dl_limit            = 'NONE',
  $randomsleep         = undef,
  $enable              = '1',
  $backup_interval     = '0',
  $backup_level        = '3',
  $max_age             = '0',
  $min_age             = '0',
  $max_size            = '0',
  $download_delta      = '0',
  $verbose             = '0',
) inherits ::apt::params {

  validate_bool(
    $legacy_origin,
    $auto_fix,
    $minimal_steps,
    $install_on_shutdown,
    $mail_only_on_error,
    $remove_unused,
    $auto_reboot
  )
  validate_array($origins)

  if $randomsleep {
    unless is_numeric($randomsleep) {
      fail('randomsleep must be numeric')
    }
  }

  package { 'unattended-upgrades':
    ensure => present,
  }

  file { '/etc/apt/apt.conf.d/50unattended-upgrades':
    ensure  => file,
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    content => template('apt/_header.erb', 'apt/50unattended-upgrades.erb'),
    require => Package['unattended-upgrades'],
  }

  file { '/etc/apt/apt.conf.d/10periodic':
    ensure  => file,
    owner   => 'root',
    group   => 'root',
    mode    => '0644',
    content => template('apt/_header.erb', 'apt/10periodic.erb'),
    require => Package['unattended-upgrades'],
  }
}