]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/apt/recipes/default.rb
Add unattended upgrades support
[chef.git] / cookbooks / apt / recipes / default.rb
index 7467ef16b845ad964030fda27218014a60227026..2fcc6fa7871b3559a4b5827c2c6c45d5c063a376 100644 (file)
@@ -109,3 +109,25 @@ apt_source "postgresql" do
   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