diff options
Diffstat (limited to 'manifests/subsystem')
-rw-r--r-- | manifests/subsystem/apt.pp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/manifests/subsystem/apt.pp b/manifests/subsystem/apt.pp index 04d6626..6c904c6 100644 --- a/manifests/subsystem/apt.pp +++ b/manifests/subsystem/apt.pp @@ -1,9 +1,10 @@ class nodo::subsystem::apt( - $ensure = present, - $auto_upgrade = present, - $hour = 2, - $minute = 0, - $mirror = 'https://deb.debian.org', + $ensure = present, + $auto_upgrade = present, + $upgrade_handler = 'apt', + $hour = 2, + $minute = 0, + $mirror = 'https://deb.debian.org', ) { package { 'apt-transport-https': ensure => installed, @@ -33,9 +34,15 @@ class nodo::subsystem::apt( } # We have /var/log/dpkg.log, so we do not need to rotate /var/log/upgrade.log - $log = ">> /var/log/upgrade.log 2>&1" - $apt = '/usr/bin/apt-get' - $command = "${apt} update ${log} && ${apt} dist-upgrade -y ${log} && ${apt} autoremove -y ${log} && ${apt} clean ${log}" + $log = ">> /var/log/upgrade.log 2>&1" + $apt = '/usr/bin/apt-get' + + if $upgrade_handler == 'apt' { + $command = "${apt} update ${log} && ${apt} dist-upgrade -y ${log} && ${apt} autoremove -y ${log} && ${apt} clean ${log}" + } + elsif $upgrade_method == 'hydra' { + $command = "hydractl upgrade clean ${log}" + } exec { 'nodo-apt-auto-update': command => "${apt} update ${log}", @@ -46,7 +53,7 @@ class nodo::subsystem::apt( cron { 'nodo-apt-auto-upgrade': ensure => $auto_upgrade, command => $command, - environment => 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + environment => [ 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', 'DEBIAN_FRONTEND=noninteractive' ], user => 'root', hour => $hour, minute => $minute, |