diff options
author | Gabriel Filion <gabster@lelutin.ca> | 2013-07-27 13:38:27 -0400 |
---|---|---|
committer | Gabriel Filion <gabster@lelutin.ca> | 2015-04-17 15:50:36 -0400 |
commit | 9192785c452ce2cfa0f58984d3aebdcaf841113a (patch) | |
tree | 78d302937259e35e62ad1e8169e4ca79670d66bd | |
parent | bb12a296a001a6b11377385b2dd40d39f6534703 (diff) |
make it possible to opt out of MailOnlyOnError
This combines all files into one template. It should make maintenance
easier.
-rw-r--r-- | files/Debian/50unattended-upgrades | 12 | ||||
-rw-r--r-- | files/Debian/50unattended-upgrades.squeeze | 14 | ||||
-rw-r--r-- | manifests/unattended_upgrades.pp | 16 | ||||
-rw-r--r-- | templates/50unattended-upgrades.erb (renamed from files/Ubuntu/50unattended-upgrades) | 14 |
4 files changed, 22 insertions, 34 deletions
diff --git a/files/Debian/50unattended-upgrades b/files/Debian/50unattended-upgrades deleted file mode 100644 index 075f680..0000000 --- a/files/Debian/50unattended-upgrades +++ /dev/null @@ -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"; diff --git a/files/Debian/50unattended-upgrades.squeeze b/files/Debian/50unattended-upgrades.squeeze deleted file mode 100644 index 77f715d..0000000 --- a/files/Debian/50unattended-upgrades.squeeze +++ /dev/null @@ -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"; diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp index 80939e3..b63b483 100644 --- a/manifests/unattended_upgrades.pp +++ b/manifests/unattended_upgrades.pp @@ -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'], } } diff --git a/files/Ubuntu/50unattended-upgrades b/templates/50unattended-upgrades.erb index 25c7758..0ba0d7e 100644 --- a/files/Ubuntu/50unattended-upgrades +++ b/templates/50unattended-upgrades.erb @@ -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 -%> |