-if node[:lsb][:release].to_f < 14.04
- apt_source "openstreetmap" do
- url "http://ppa.launchpad.net/osmadmins/ppa/ubuntu"
- key "0AC4F2CB"
+template "/etc/apt/sources.list" do
+ source "sources.list.erb"
+ owner "root"
+ group "root"
+ mode "644"
+ variables :archive_host => archive_host,
+ :archive_security_host => archive_security_host,
+ :archive_distro => archive_distro,
+ :archive_security_distro => archive_security_distro,
+ :archive_suites => archive_suites,
+ :archive_components => archive_components,
+ :codename => node[:lsb][:codename]
+ notifies :update, "apt_update[/etc/apt/sources.list]", :immediately
+end
+
+apt_repository "openstreetmap" do
+ uri "ppa:osmadmins/ppa"
+ only_if { platform?("ubuntu") }
+end
+
+package "unattended-upgrades"
+
+if Dir.exist?("/usr/share/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 "644"
+ content auto_upgrades