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, } }