From e8258e2b5774c58231ca827229734c2bb8544e04 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sat, 4 Aug 2012 10:31:59 -0500 Subject: [PATCH] Replace use of local apt module with upstream. Change-Id: Idcf8af9712f8d10b50cfffc0aa74f7caa1a24c77 Reviewed-on: https://review.openstack.org/10833 Reviewed-by: Clark Boylan Reviewed-by: James E. Blair Approved: Monty Taylor Tested-by: Jenkins --- files/10periodic | 6 ++++++ files/50unattended-upgrades | 30 ++++++++++++++++++++++++++++++ manifests/init.pp | 28 ++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 files/10periodic create mode 100644 files/50unattended-upgrades create mode 100644 manifests/init.pp diff --git a/files/10periodic b/files/10periodic new file mode 100644 index 0000000..83f51c6 --- /dev/null +++ b/files/10periodic @@ -0,0 +1,6 @@ +APT::Periodic::Enable "1"; +APT::Periodic::Update-Package-Lists "1"; +APT::Periodic::Download-Upgradeable-Packages "1"; +APT::Periodic::AutocleanInterval "5"; +APT::Periodic::Unattended-Upgrade "1"; +APT::Periodic::RandomSleep "1800"; diff --git a/files/50unattended-upgrades b/files/50unattended-upgrades new file mode 100644 index 0000000..0a09ce0 --- /dev/null +++ b/files/50unattended-upgrades @@ -0,0 +1,30 @@ +// Automatically upgrade packages from these (origin, archive) pairs +Unattended-Upgrade::Allowed-Origins { + // ${distro_id} and ${distro_codename} will be automatically expanded + "${distro_id} stable"; + "${distro_id} ${distro_codename}-security"; + "${distro_id} ${distro_codename}-updates"; +// "${distro_id} ${distro_codename}-proposed-updates"; +}; + +// List of packages to not update +Unattended-Upgrade::Package-Blacklist { +// "vim"; +// "libc6"; +// "libc6-dev"; +// "libc6-i686"; +}; + +// Send email to this address for problems or packages upgrades +// If empty or unset then no email is sent, make sure that you +// have a working mail setup on your system. The package 'mailx' +// must be installed or anything that provides /usr/bin/mail. +Unattended-Upgrade::Mail "root"; + +// Do automatic removal of new unused dependencies after the upgrade +// (equivalent to apt-get autoremove) +//Unattended-Upgrade::Remove-Unused-Dependencies "false"; + +// Automatically reboot *WITHOUT CONFIRMATION* if a +// the file /var/run/reboot-required is found after the upgrade +//Unattended-Upgrade::Automatic-Reboot "false"; diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..74b6e95 --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,28 @@ +class unattended_upgrades($ensure = present) { + package { 'unattended-upgrades': + ensure => $ensure; + } + + package { 'mailutils': + ensure => $ensure; + } + + file { '/etc/apt/apt.conf.d/10periodic': + owner => 'root', + group => 'root', + mode => 444, + ensure => $ensure, + source => "puppet:///modules/unattended_upgrades/10periodic", + replace => 'true', + } + + file { '/etc/apt/apt.conf.d/50unattended-upgrades': + owner => 'root', + group => 'root', + mode => 444, + ensure => $ensure, + source => "puppet:///modules/unattended_upgrades/50unattended-upgrades", + replace => 'true', + } + +}