aboutsummaryrefslogtreecommitdiff
path: root/manifests/subsystem/apt.pp
blob: 83d49aa815560a4ec26a780d5f8d9b7945ccef9e (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
class nodo::subsystem::apt(
  $ensure       = present,
  $auto_upgrade = present,
) {
  file { '/etc/apt/sources.list':
    ensure  => $ensure ? {
      'present' => 'present',
       default  => undef,
    },
    owner   => root,
    group   => root,
    mode    => 0644,
    content => template("nodo/apt/${::operatingsystem}.sources.list.erb"),
  }

  $apt     = '/usr/bin/apt-get'
  $command = "${apt} update && ${apt} dist-upgrade -y && ${apt} autoremove -y && ${apt} clean"

  cron { 'nodo-apt-auto-upgrade':
    ensure  => $auto_upgrade,
    command => $command,
    user    => 'root',
    hour    => 2,
    minute  => 0,
  }
}