make it possible to opt out of MailOnlyOnError

This combines all files into one template. It should make maintenance
easier.
This commit is contained in:
Gabriel Filion 2013-07-27 13:38:27 -04:00
parent bb12a296a0
commit 9192785c45
4 changed files with 22 additions and 34 deletions

View file

@ -1,12 +0,0 @@
// this file is managed by puppet !
Unattended-Upgrade::Origins-Pattern {
"o=Debian,a=oldstable,l=Debian-Security";
"o=Debian,a=stable,l=Debian-Security";
}
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::Unattended-Upgrade "1";
Unattended-Upgrade::Mail "root";

View file

@ -1,14 +0,0 @@
// this file is managed by puppet !
Unattended-Upgrade::Allowed-Origins {
// "${distro-id} oldstable";
// "${distro_id} ${distro_codename}-backports";
"${distro_id} ${distro_codename}-security";
"${distro_id} ${distro_codename}-lts";
};
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::Unattended-Upgrade "1";
Unattended-Upgrade::Mail "root";

View file

@ -1,15 +1,19 @@
class apt::unattended_upgrades {
class apt::unattended_upgrades (
$config_content = undef,
$mailonlyonerror = true,
) {
package { 'unattended-upgrades':
ensure => present
}
$file_content = $config_content ? {
undef => template('apt/50unattended-upgrades.erb'),
default => $config_content
}
apt_conf { '50unattended-upgrades':
source => [
"puppet:///modules/site_apt/${::lsbdistid}/50unattended-upgrades.${::lsbdistcodename}",
"puppet:///modules/site_apt/${::lsbdistid}/50unattended-upgrades",
"puppet:///modules/apt/${::lsbdistid}/50unattended-upgrades.${::lsbdistcodename}",
"puppet:///modules/apt/${::lsbdistid}/50unattended-upgrades" ],
content => $file_content,
require => Package['unattended-upgrades'],
}
}

View file

@ -1,16 +1,26 @@
// this file is managed by puppet !
Unattended-Upgrade::Allowed-Origins {
<% if scope.lookupvar('::operatingsystem') == 'Ubuntu' -%>
"${distro_id}:${distro_codename}-security";
"${distro_id}:${distro_codename}-updates";
"${distro_id}:${distro_codename}-backports";
//"${distro_id}:${distro_codename}-proposed";
<% else -%>
<% if scope.lookupvar('::lsbdistcodename') == 'squeeze' -%>
"${distro-id} ${distro-codename}-security";
"${distro-id} ${distro-codename}-lts";
<% else -%>
# See Debian bug #704087
"o=Debian,a=oldstable,l=Debian-Security";
"o=Debian,a=stable,l=Debian-Security";
<% end -%>
};
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::Unattended-Upgrade "1";
Unattended-Upgrade::Mail "root";
<% if mailonlyonerror -%>
Unattended-Upgrade::MailOnlyOnError "true";
<% end -%>