diff options
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/apt_conf.pp | 15 | ||||
-rw-r--r-- | manifests/apticron.pp | 26 | ||||
-rw-r--r-- | manifests/config.pp | 89 | ||||
-rw-r--r-- | manifests/cron/dist_upgrade.pp | 15 | ||||
-rw-r--r-- | manifests/dist_upgrade.pp | 3 | ||||
-rw-r--r-- | manifests/dist_upgrade/initiator.pp | 9 | ||||
-rw-r--r-- | manifests/dot_d_directories.pp | 9 | ||||
-rw-r--r-- | manifests/dselect.pp | 5 | ||||
-rw-r--r-- | manifests/init.pp | 131 | ||||
-rw-r--r-- | manifests/install.pp | 11 | ||||
-rw-r--r-- | manifests/key.pp | 2 | ||||
-rw-r--r-- | manifests/key/plain.pp | 2 | ||||
-rw-r--r-- | manifests/listchanges.pp | 21 | ||||
-rw-r--r-- | manifests/params.pp | 18 | ||||
-rw-r--r-- | manifests/preferences.pp | 1 | ||||
-rw-r--r-- | manifests/preferences_snippet.pp | 24 | ||||
-rw-r--r-- | manifests/preseeded_package.pp | 8 | ||||
-rw-r--r-- | manifests/proxy_client.pp | 6 | ||||
-rw-r--r-- | manifests/reboot_required_notify.pp | 1 | ||||
-rw-r--r-- | manifests/reboot_required_notify/jessie.pp | 1 | ||||
-rw-r--r-- | manifests/reboot_required_notify/wheezy.pp | 1 | ||||
-rw-r--r-- | manifests/sources_list.pp | 5 | ||||
-rw-r--r-- | manifests/unattended_upgrades.pp | 16 | ||||
-rw-r--r-- | manifests/update.pp | 3 | ||||
-rw-r--r-- | manifests/upgrade_package.pp | 12 |
25 files changed, 223 insertions, 211 deletions
diff --git a/manifests/apt_conf.pp b/manifests/apt_conf.pp index fa8cfa3..8225915 100644 --- a/manifests/apt_conf.pp +++ b/manifests/apt_conf.pp @@ -1,9 +1,9 @@ -define apt::apt_conf( - $ensure = 'present', - $source = undef, - $content = undef, - $refresh_apt = true ) -{ +define apt::apt_conf ( + $ensure = 'present', + $source = undef, + $content = undef, + $refresh_apt = true, +) { if $source == undef and $content == undef { fail("One of \$source or \$content must be specified for apt_conf ${name}") @@ -38,8 +38,7 @@ define apt::apt_conf( if $refresh_apt { File["/etc/apt/apt.conf.d/${name}"] { - notify => Exec['apt_updated'], + notify => Exec['update_apt'], } } - } diff --git a/manifests/apticron.pp b/manifests/apticron.pp index 89709a8..0adcc68 100644 --- a/manifests/apticron.pp +++ b/manifests/apticron.pp @@ -1,18 +1,20 @@ -class apt::apticron( - $ensure_version = 'installed', - $config = "apt/${::operatingsystem}/apticron.erb", - $email = 'root', - $diff_only = '1', +class apt::apticron ( + $ensure_version = 'present', + $config = "apt/${::operatingsystem}/apticron.erb", + $email = 'root', + $diff_only = '1', $listchanges_profile = 'apticron', - $system = false, - $ipaddressnum = false, - $ipaddresses = false, - $notifyholds = '0', - $notifynew = '0', - $customsubject = '' + $system = false, + $ipaddressnum = false, + $ipaddresses = false, + $notifyholds = '0', + $notifynew = '0', + $customsubject = '', ) { - package { 'apticron': ensure => $ensure_version } + package { 'apticron': + ensure => $ensure_version; + } file { '/etc/apticron/apticron.conf': content => template($apt::apticron::config), diff --git a/manifests/config.pp b/manifests/config.pp new file mode 100644 index 0000000..542fc1f --- /dev/null +++ b/manifests/config.pp @@ -0,0 +1,89 @@ +class apt::config { + + exec { 'update_apt': + command => '/usr/bin/apt-get update', + require => [ File['/etc/apt/apt.conf.d', + '/etc/apt/preferences', + '/etc/apt/sources.list'] ], + refreshonly => true; + } + + $sources_content = $apt::custom_sources_list ? { + '' => template( "apt/${::operatingsystem}/sources.list.erb"), + default => $apt::custom_sources_list, + } + file { + # include main and security + # additional sources should be included via the apt::sources_list define + '/etc/apt/sources.list': + content => $sources_content, + notify => Exec['update_apt'], + owner => root, + group => 0, + mode => '0644'; + } + + # workaround for preseeded_package component + file { + [ '/var/cache', + '/var/cache/local', + '/var/cache/local/preseeding' ]: + ensure => directory; + } + + ::apt::apt_conf { '02show_upgraded': + source => [ "puppet:///modules/site_apt/${::fqdn}/02show_upgraded", + 'puppet:///modules/site_apt/02show_upgraded', + 'puppet:///modules/apt/02show_upgraded' ]; + } + + if ( $::virtual == 'vserver' ) { + ::apt::apt_conf { '03clean_vserver': + source => [ "puppet:///modules/site_apt/${::fqdn}/03clean_vserver", + 'puppet:///modules/site_apt/03clean_vserver', + 'puppet:///modules/apt/03clean_vserver' ], + alias => '03clean'; + } + } + else { + ::apt::apt_conf { '03clean': + source => [ "puppet:///modules/site_apt/${::fqdn}/03clean", + 'puppet:///modules/site_apt/03clean', + 'puppet:///modules/apt/03clean' ]; + } + } + + if ($apt::use_backports and !($::debian_release in ['testing', 'unstable', 'experimental'])) { + apt::sources_list { + 'backports': + content => "deb ${apt::debian_url} ${::debian_codename}-backports ${apt::repos}", + } + if $apt::include_src { + apt::sources_list { + 'backports-src': + content => "deb-src ${apt::debian_url} ${::debian_codename}-backports ${apt::repos}", + } + } + } + + if $apt::custom_key_dir { + file { "${apt::apt_base_dir}/keys.d": + source => $apt::custom_key_dir, + recurse => true, + owner => root, + group => root, + mode => '0755', + } + exec { 'custom_keys': + command => "find ${apt::apt_base_dir}/keys.d -type f -exec apt-key add '{}' \\;", + subscribe => File["${apt::apt_base_dir}/keys.d"], + refreshonly => true, + notify => Exec['update_apt']; + } + if $apt::custom_preferences != false { + Exec['custom_keys'] { + before => File['apt_config'], + } + } + } +} diff --git a/manifests/cron/dist_upgrade.pp b/manifests/cron/dist_upgrade.pp index e1a03ed..db36544 100644 --- a/manifests/cron/dist_upgrade.pp +++ b/manifests/cron/dist_upgrade.pp @@ -2,7 +2,9 @@ class apt::cron::dist_upgrade ( $cron_hours = '', ) { - package { 'cron-apt': ensure => installed } + package { 'cron-apt': + ensure => present; + } case $cron_hours { '': {} @@ -12,7 +14,7 @@ class apt::cron::dist_upgrade ( cron { 'apt_cron_every_N_hours': command => 'test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt', user => root, - hour => "${cron_hours}", + hour => $cron_hours, minute => 10, require => Package['cron-apt'], } @@ -27,14 +29,16 @@ dist-upgrade -y -o APT::Get::Show-Upgraded=true -o 'DPkg::Options::=--force-conf ensure => absent, } - package { 'apt-listbugs': ensure => absent } + package { 'apt-listbugs': + ensure => absent; + } file { '/etc/cron-apt/action.d/4-dist-upgrade': content => $action, owner => root, group => 0, mode => '0644', - require => Package[cron-apt]; + require => Package['cron-apt']; } file { '/etc/cron-apt/config.d/MAILON': @@ -42,7 +46,6 @@ dist-upgrade -y -o APT::Get::Show-Upgraded=true -o 'DPkg::Options::=--force-conf owner => root, group => 0, mode => '0644', - require => Package[cron-apt]; + require => Package['cron-apt']; } - } diff --git a/manifests/dist_upgrade.pp b/manifests/dist_upgrade.pp index 3061fb8..eb3207c 100644 --- a/manifests/dist_upgrade.pp +++ b/manifests/dist_upgrade.pp @@ -6,7 +6,6 @@ class apt::dist_upgrade ( command => '/usr/bin/apt-get -q -y -o \'DPkg::Options::=--force-confold\' dist-upgrade', refreshonly => true, timeout => $timeout, - before => Exec['apt_updated'] + before => Exec['update_apt']; } - } diff --git a/manifests/dist_upgrade/initiator.pp b/manifests/dist_upgrade/initiator.pp index d238988..5dfce14 100644 --- a/manifests/dist_upgrade/initiator.pp +++ b/manifests/dist_upgrade/initiator.pp @@ -1,6 +1,6 @@ class apt::dist_upgrade::initiator inherits apt::dist_upgrade { - $initiator = 'upgrade_initiator' + $initiator = 'upgrade_initiator' $initiator_abs = "${apt::apt_base_dir}/${initiator}" file { 'apt_upgrade_initiator': @@ -9,15 +9,12 @@ class apt::dist_upgrade::initiator inherits apt::dist_upgrade { group => 0, path => $initiator_abs, checksum => md5, - source => [ - "puppet:///modules/site_apt/${::fqdn}/${initiator}", + source => [ "puppet:///modules/site_apt/${::fqdn}/${initiator}", "puppet:///modules/site_apt/${initiator}", - "puppet:///modules/apt/${initiator}", - ], + "puppet:///modules/apt/${initiator}" ], } Exec['apt_dist-upgrade'] { subscribe +> File['apt_upgrade_initiator'], } - } diff --git a/manifests/dot_d_directories.pp b/manifests/dot_d_directories.pp index 0ace863..6d9f790 100644 --- a/manifests/dot_d_directories.pp +++ b/manifests/dot_d_directories.pp @@ -1,15 +1,16 @@ +# watch .d directories and ensure they are present + class apt::dot_d_directories { - # watch .d directories and ensure they are present file { '/etc/apt/apt.conf.d': ensure => directory, checksum => mtime, - notify => Exec['apt_updated']; + notify => Exec['update_apt']; + '/etc/apt/sources.list.d': ensure => directory, checksum => mtime, - notify => Exec['apt_updated']; + notify => Exec['update_apt']; } - } diff --git a/manifests/dselect.pp b/manifests/dselect.pp index 2b99a43..bfc6cb3 100644 --- a/manifests/dselect.pp +++ b/manifests/dselect.pp @@ -1,5 +1,6 @@ # manage dselect, like # suppressing the annoying help texts + class apt::dselect { file_line { 'dselect_expert': @@ -7,5 +8,7 @@ class apt::dselect { line => 'expert', } - package { 'dselect': ensure => installed } + package { 'dselect': + ensure => present; + } } diff --git a/manifests/init.pp b/manifests/init.pp index 3d93d22..26afaeb 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -3,64 +3,30 @@ # Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at> # See LICENSE for the full license granted to you. -class apt( - $use_lts = $apt::params::use_lts, - $use_volatile = $apt::params::use_volatile, - $use_backports = $apt::params::use_backports, - $include_src = $apt::params::include_src, - $use_next_release = $apt::params::use_next_release, - $debian_url = $apt::params::debian_url, - $security_url = $apt::params::security_url, - $lts_url = $apt::params::lts_url, - $volatile_url = $apt::params::volatile_url, - $ubuntu_url = $apt::params::ubuntu_url, - $repos = $apt::params::repos, - $custom_preferences = $apt::params::custom_preferences, +class apt ( + $use_lts = $apt::params::use_lts, + $use_volatile = $apt::params::use_volatile, + $use_backports = $apt::params::use_backports, + $include_src = $apt::params::include_src, + $use_next_release = $apt::params::use_next_release, + $debian_url = $apt::params::debian_url, + $security_url = $apt::params::security_url, + $lts_url = $apt::params::lts_url, + $volatile_url = $apt::params::volatile_url, + $ubuntu_url = $apt::params::ubuntu_url, + $repos = $apt::params::repos, + $custom_preferences = $apt::params::custom_preferences, $custom_sources_list = '', - $custom_key_dir = $apt::params::custom_key_dir + $custom_key_dir = $apt::params::custom_key_dir, ) inherits apt::params { - package { 'apt': - ensure => installed, - require => undef, - } - - $sources_content = $custom_sources_list ? { - '' => template( "apt/${::operatingsystem}/sources.list.erb"), - default => $custom_sources_list - } - file { - # include main and security - # additional sources should be included via the apt::sources_list define - '/etc/apt/sources.list': - content => $sources_content, - notify => Exec['apt_updated'], - owner => root, - group => 0, - mode => '0644'; - } - - ::apt::apt_conf { '02show_upgraded': - source => [ "puppet:///modules/site_apt/${::fqdn}/02show_upgraded", - 'puppet:///modules/site_apt/02show_upgraded', - 'puppet:///modules/apt/02show_upgraded' ] - } + include apt::dot_d_directories + include apt::config + include apt::install - if ( $::virtual == 'vserver' ) { - ::apt::apt_conf { '03clean_vserver': - source => [ "puppet:///modules/site_apt/${::fqdn}/03clean_vserver", - 'puppet:///modules/site_apt/03clean_vserver', - 'puppet:///modules/apt/03clean_vserver' ], - alias => '03clean'; - } - } - else { - ::apt::apt_conf { '03clean': - source => [ "puppet:///modules/site_apt/${::fqdn}/03clean", - 'puppet:///modules/site_apt/03clean', - 'puppet:///modules/apt/03clean' ] - } - } + include common::moduledir + common::module_dir { 'apt': } + $apt_base_dir = "${common::moduledir::module_dir_path}/apt" case $custom_preferences { false: { @@ -70,61 +36,4 @@ class apt( include apt::preferences } } - - include apt::dot_d_directories - - ## This package should really always be current - package { 'debian-archive-keyring': ensure => latest } - - if ($use_backports and !($::debian_release in ['testing', 'unstable', 'experimental'])) { - apt::sources_list { - 'backports': - content => "deb ${debian_url} ${::debian_codename}-backports ${apt::repos}", - } - if $include_src { - apt::sources_list { - 'backports-src': - content => "deb-src ${debian_url} ${::debian_codename}-backports ${apt::repos}", - } - } - } - - include common::moduledir - common::module_dir { 'apt': } - $apt_base_dir = "${common::moduledir::module_dir_path}/apt" - - if $custom_key_dir { - file { "${apt_base_dir}/keys.d": - source => $custom_key_dir, - recurse => true, - owner => root, - group => root, - mode => '0755', - } - exec { 'custom_keys': - command => "find ${apt_base_dir}/keys.d -type f -exec apt-key add '{}' \\;", - subscribe => File["${apt_base_dir}/keys.d"], - refreshonly => true, - notify => Exec[refresh_apt] - } - if $custom_preferences != false { - Exec['custom_keys'] { - before => File['apt_config'] - } - } - } - - # workaround for preseeded_package component - file { [ '/var/cache', '/var/cache/local', '/var/cache/local/preseeding' ]: ensure => directory } - - exec { 'update_apt': - command => '/usr/bin/apt-get update', - require => [ - File['/etc/apt/apt.conf.d', '/etc/apt/preferences' ], - File['/etc/apt/sources.list'] ], - refreshonly => true, - # Another Semaphor for all packages to reference - alias => [ 'apt_updated', 'refresh_apt'] - } - } diff --git a/manifests/install.pp b/manifests/install.pp new file mode 100644 index 0000000..76eb570 --- /dev/null +++ b/manifests/install.pp @@ -0,0 +1,11 @@ +class apt::install { + + package { 'apt': + ensure => present; + } + + # This package should really always be current + package { 'debian-archive-keyring': + ensure => latest; + } +} diff --git a/manifests/key.pp b/manifests/key.pp index cb70ec6..6ec6523 100644 --- a/manifests/key.pp +++ b/manifests/key.pp @@ -8,6 +8,6 @@ define apt::key ($source, $ensure = 'present') { "/etc/apt/trusted.gpg.d/${name}": ensure => $ensure, source => $source, - notify => Exec['apt_updated'], + notify => Exec['update_apt'], } } diff --git a/manifests/key/plain.pp b/manifests/key/plain.pp index dff8b51..e845b88 100644 --- a/manifests/key/plain.pp +++ b/manifests/key/plain.pp @@ -8,6 +8,6 @@ define apt::key::plain ($source) { exec { "apt-key add '${apt::apt_base_dir}/keys/${name}'": subscribe => File["${apt::apt_base_dir}/keys/${name}"], refreshonly => true, - notify => Exec['apt_updated'], + notify => Exec['update_apt'], } } diff --git a/manifests/listchanges.pp b/manifests/listchanges.pp index ecbbe6d..d657812 100644 --- a/manifests/listchanges.pp +++ b/manifests/listchanges.pp @@ -1,13 +1,16 @@ -class apt::listchanges( - $ensure_version = 'installed', - $config = "apt/${::operatingsystem}/listchanges.erb", - $frontend = 'mail', - $email = 'root', - $confirm = '0', - $saveseen = '/var/lib/apt/listchanges.db', - $which = 'both' +class apt::listchanges ( + $ensure_version = 'present', + $config = "apt/${::operatingsystem}/listchanges.erb", + $frontend = 'mail', + $email = 'root', + $confirm = '0', + $saveseen = '/var/lib/apt/listchanges.db', + $which = 'both', ){ - package { 'apt-listchanges': ensure => $ensure_version } + + package { 'apt-listchanges': + ensure => $ensure_version; + } file { '/etc/apt/listchanges.conf': content => template($apt::listchanges::config), diff --git a/manifests/params.pp b/manifests/params.pp index 2b18eb5..463cd63 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -1,14 +1,14 @@ class apt::params () { - $use_lts = false - $use_volatile = false - $use_backports = true - $include_src = false + $use_lts = false + $use_volatile = false + $use_backports = true + $include_src = false $use_next_release = false - $debian_url = 'http://httpredir.debian.org/debian/' - $security_url = 'http://security.debian.org/' - $ubuntu_url = 'http://archive.ubuntu.com/ubuntu' - $lts_url = $debian_url - $volatile_url = 'http://volatile.debian.org/debian-volatile/' + $debian_url = 'http://httpredir.debian.org/debian/' + $security_url = 'http://security.debian.org/' + $ubuntu_url = 'http://archive.ubuntu.com/ubuntu' + $lts_url = $debian_url + $volatile_url = 'http://volatile.debian.org/debian-volatile/' case $::operatingsystem { 'debian': { $repos = 'main contrib non-free' diff --git a/manifests/preferences.pp b/manifests/preferences.pp index aedd56b..d3eb780 100644 --- a/manifests/preferences.pp +++ b/manifests/preferences.pp @@ -16,5 +16,4 @@ class apt::preferences { require => File['/etc/apt/sources.list'], owner => root, group => 0, mode => '0644'; } - } diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp index 2b2fb74..8905318 100644 --- a/manifests/preferences_snippet.pp +++ b/manifests/preferences_snippet.pp @@ -1,10 +1,10 @@ define apt::preferences_snippet ( $priority = undef, - $package = false, - $ensure = 'present', - $source = undef, - $release = undef, - $pin = undef + $package = false, + $ensure = 'present', + $source = undef, + $release = undef, + $pin = undef, ) { $real_package = $package ? { @@ -18,21 +18,21 @@ define apt::preferences_snippet ( } if $priority == undef { - fail('apt::preferences_snippet requires the \'priority\' argument to be set') + fail("apt::preferences_snippet requires the 'priority' argument to be set") } if !$pin and !$release { - fail('apt::preferences_snippet requires one of the \'pin\' or \'release\' argument to be set') + fail("apt::preferences_snippet requires one of the 'pin' or 'release' argument to be set") } if $pin and $release { - fail('apt::preferences_snippet requires either a \'pin\' or \'release\' argument, not both') + fail("apt::preferences_snippet requires either a 'pin' or 'release' argument, not both") } } file { "/etc/apt/preferences.d/${name}": ensure => $ensure, owner => root, group => 0, mode => '0644', - before => Exec['apt_updated']; + before => Exec['update_apt']; } case $source { @@ -40,19 +40,19 @@ define apt::preferences_snippet ( case $release { undef: { File["/etc/apt/preferences.d/${name}"]{ - content => template('apt/preferences_snippet.erb') + content => template('apt/preferences_snippet.erb'), } } default: { File["/etc/apt/preferences.d/${name}"]{ - content => template('apt/preferences_snippet_release.erb') + content => template('apt/preferences_snippet_release.erb'), } } } } default: { File["/etc/apt/preferences.d/${name}"]{ - source => $source + source => $source, } } } diff --git a/manifests/preseeded_package.pp b/manifests/preseeded_package.pp index 162ade7..29a981e 100644 --- a/manifests/preseeded_package.pp +++ b/manifests/preseeded_package.pp @@ -1,12 +1,14 @@ # Install a package with a preseed file to automatically answer some questions. + define apt::preseeded_package ( - $ensure = 'installed', - $content = '' + $ensure = 'present', + $content = '', ) { + $seedfile = "/var/cache/local/preseeding/${name}.seeds" $real_content = $content ? { '' => template ( "site_apt/${::debian_codename}/${name}.seeds" ), - default => $content + default => $content, } file { $seedfile: diff --git a/manifests/proxy_client.pp b/manifests/proxy_client.pp index e7972f7..0793878 100644 --- a/manifests/proxy_client.pp +++ b/manifests/proxy_client.pp @@ -1,7 +1,7 @@ -class apt::proxy_client( +class apt::proxy_client ( $proxy = 'http://localhost', - $port = '3142', -){ + $port = '3142', +) { ::apt::apt_conf { '20proxy': content => template('apt/20proxy.erb'), diff --git a/manifests/reboot_required_notify.pp b/manifests/reboot_required_notify.pp index efd8aeb..3463bb4 100644 --- a/manifests/reboot_required_notify.pp +++ b/manifests/reboot_required_notify.pp @@ -7,5 +7,4 @@ class apt::reboot_required_notify { } else { class { 'apt::reboot_required_notify::wheezy': } } - } diff --git a/manifests/reboot_required_notify/jessie.pp b/manifests/reboot_required_notify/jessie.pp index 18e619d..fcd3fb3 100644 --- a/manifests/reboot_required_notify/jessie.pp +++ b/manifests/reboot_required_notify/jessie.pp @@ -26,5 +26,4 @@ class apt::reboot_required_notify::jessie ($ensure = present) { ensure => $ensure, require => Apt::Preferences_snippet['reboot-notifier'], } - } diff --git a/manifests/reboot_required_notify/wheezy.pp b/manifests/reboot_required_notify/wheezy.pp index 06998ef..1ad46cd 100644 --- a/manifests/reboot_required_notify/wheezy.pp +++ b/manifests/reboot_required_notify/wheezy.pp @@ -19,5 +19,4 @@ class apt::reboot_required_notify::wheezy ($ensure = present) { minute => 20, require => Package['update-notifier-common'], } - } diff --git a/manifests/sources_list.pp b/manifests/sources_list.pp index 6ff4fc3..35a7643 100644 --- a/manifests/sources_list.pp +++ b/manifests/sources_list.pp @@ -1,8 +1,9 @@ # Configure an apt source + define apt::sources_list ( $ensure = 'present', $source = undef, - $content = undef + $content = undef, ) { if $ensure == 'present' { @@ -26,7 +27,7 @@ define apt::sources_list ( mode => '0644', owner => 'root', group => 0, - notify => Exec['apt_updated'], + notify => Exec['update_apt'], } if $source { diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp index d604125..c6db396 100644 --- a/manifests/unattended_upgrades.pp +++ b/manifests/unattended_upgrades.pp @@ -1,14 +1,14 @@ class apt::unattended_upgrades ( - $config_content = undef, - $config_template = 'apt/50unattended-upgrades.erb', - $mailonlyonerror = true, - $mail_recipient = 'root', + $config_content = undef, + $config_template = 'apt/50unattended-upgrades.erb', + $mailonlyonerror = true, + $mail_recipient = 'root', $blacklisted_packages = [], - $ensure_version = present + $ensure_version = 'present', ) { package { 'unattended-upgrades': - ensure => $ensure_version + ensure => $ensure_version, } # For some reason, this directory is sometimes absent, which causes @@ -23,12 +23,12 @@ class apt::unattended_upgrades ( $file_content = $config_content ? { undef => template($config_template), - default => $config_content + default => $config_content, } ::apt::apt_conf { '50unattended-upgrades': content => $file_content, require => Package['unattended-upgrades'], - refresh_apt => false + refresh_apt => false; } } diff --git a/manifests/update.pp b/manifests/update.pp index dde8320..72cedc2 100644 --- a/manifests/update.pp +++ b/manifests/update.pp @@ -1,7 +1,6 @@ class apt::update inherits ::apt { Exec['update_apt'] { - refreshonly => false + refreshonly => false, } - } diff --git a/manifests/upgrade_package.pp b/manifests/upgrade_package.pp index e61b15d..3ba2077 100644 --- a/manifests/upgrade_package.pp +++ b/manifests/upgrade_package.pp @@ -1,7 +1,8 @@ # Install a package either to a certain version, or while making sure that it's # always the latest version that's installed. + define apt::upgrade_package ( - $version = '' + $version = '', ) { $version_suffix = $version ? { @@ -12,22 +13,19 @@ define apt::upgrade_package ( if !defined(Package['apt-show-versions']) { package { 'apt-show-versions': - ensure => installed, - require => undef, + ensure => present, } } if !defined(Package['dctrl-tools']) { package { 'dctrl-tools': - ensure => installed, - require => undef, + ensure => present, } } exec { "apt-get -q -y -o 'DPkg::Options::=--force-confold' install ${name}${version_suffix}": onlyif => [ "grep-status -F Status installed -a -P ${name} -q", "apt-show-versions -u ${name} | grep -q upgradeable" ], require => Package['apt-show-versions', 'dctrl-tools'], - before => Exec['apt_updated'] + before => Exec['update_apt']; } - } |