Bring unattended-upgrades support into chef. Many of the servers already
have unattended-upgrades installed and partially configured.
By default enable, specifically disable on DB role machines.
Also enable removal of unused dependencies, which is primarily used
for removing unused kernel packages.
default_unless[:apt][:sources] = []
default_unless[:apt][:sources] = []
+
+default[:apt][:unattended_upgrades][:enable] = true
+default[:apt][:unattended_upgrades][:remove_unused_dependencies] = true
url "http://apt.postgresql.org/pub/repos/apt"
key "ACCC4CF8"
end
url "http://apt.postgresql.org/pub/repos/apt"
key "ACCC4CF8"
end
+
+package "unattended-upgrades"
+
+auto_upgrades = if node[:apt][:unattended_upgrades][:enable]
+ IO.read("/usr/share/unattended-upgrades/20auto-upgrades")
+ else
+ IO.read("/usr/share/unattended-upgrades/20auto-upgrades-disabled")
+ end
+
+file "/etc/apt/apt.conf.d/20auto-upgrades" do
+ user "root"
+ group "root"
+ mode 0644
+ content auto_upgrades
+end
+
+template "/etc/apt/apt.conf.d/60chef" do
+ source "apt.conf.erb"
+ owner "root"
+ group "root"
+ mode 0644
+end
--- /dev/null
+// DO NOT EDIT - This file is being maintained by Chef
+
+// Do automatic removal of new unused dependencies after the upgrade
+// (equivalent to apt-get autoremove)
+Unattended-Upgrade::Remove-Unused-Dependencies "<%= node[:apt][:unattended_upgrades][:remove_unused_dependencies] ? 'true' : 'false' %>";
+ :apt => {
+ :unattended_upgrades => {
+ :enable => false
+ }
+ },
:munin => {
:plugins => {
:postgres_connections_openstreetmap => {
:munin => {
:plugins => {
:postgres_connections_openstreetmap => {