aboutsummaryrefslogtreecommitdiff
path: root/manifests/subsystem/apt.pp
blob: dffd42ab95d7d1b431f202680c83dbcb345e14f0 (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
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,
    environment => 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
    user        => 'root',
    hour        => 2,
    minute      => 0,
  }
}