summaryrefslogtreecommitdiff
path: root/manifests/cron/dist_upgrade.pp
blob: e1a03ede6b583d322910445a9f0a125161e203da (plain)
1
2
3
4
5
6
7
8
9
10
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
36
37
38
39
40
41
42
43
44
45
46
47
48
class apt::cron::dist_upgrade (
  $cron_hours = '',
) {

  package { 'cron-apt': ensure => installed }

  case $cron_hours {
    '': {}
    default: {
      # cron-apt defaults to run every night at 4 o'clock
      # so we try not to run at the same time.
      cron { 'apt_cron_every_N_hours':
        command => 'test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt',
        user    => root,
        hour    => "${cron_hours}",
        minute  => 10,
        require => Package['cron-apt'],
      }
    }
  }

  $action = "autoclean -y
dist-upgrade -y -o APT::Get::Show-Upgraded=true -o 'DPkg::Options::=--force-confold'
"

  file { '/etc/cron-apt/action.d/3-download':
    ensure => absent,
  }

  package { 'apt-listbugs': ensure => absent }

  file { '/etc/cron-apt/action.d/4-dist-upgrade':
    content => $action,
    owner   => root,
    group   => 0,
    mode    => '0644',
    require => Package[cron-apt];
  }

  file { '/etc/cron-apt/config.d/MAILON':
    content => "MAILON=upgrade\n",
    owner   => root,
    group   => 0,
    mode    => '0644',
    require => Package[cron-apt];
  }

}