diff options
-rw-r--r-- | manifests/init.pp | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 9ef9768..a791a37 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -16,6 +16,11 @@ class apt { default => $backports_enabled, } + $apt_update_method = $apt_update_method { + '' => 'exec', + default => $apt_update_method, + } + package { apt: ensure => installed } # a few templates need lsbdistcodename @@ -83,13 +88,25 @@ class apt { refreshonly => true, subscribe => [ File["/etc/apt/sources.list"], File["/etc/apt/preferences"], File["/etc/apt/apt.conf.d"], - File[apt_config] ]; - "/usr/bin/apt-get update && /usr/bin/apt-get autoclean #hourly": - require => [ File["/etc/apt/sources.list"], - File["/etc/apt/preferences"], File[apt_config] ], - # Another Semaphor for all packages to reference - alias => apt_updated; - } + File[apt_config] ], + } + + if $apt_update_method == 'exec' { + exec { "/usr/bin/apt-get update && /usr/bin/apt-get autoclean #hourly": + require => [ File["/etc/apt/sources.list"], File["/etc/apt/preferences"], File[apt_config] ], + # Another Semaphor for all packages to reference + alias => apt_updated, + } + } else { + cron { "apt_updated": + command => "/usr/bin/apt-get update && /usr/bin/apt-get autoclean #hourly &> /dev/null", + user => root, + hour => "*/1", + minute => "0", + ensure => present, + require => [ File["/etc/apt/sources.list"], File["/etc/apt/preferences"], File[apt_config] ], + } + } ## This package should really always be current package { "debian-archive-keyring": |