5 # Copyright:: 2010, Tom Hughes
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # https://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
26 package "update-notifier-common" if platform?("ubuntu")
28 file "/etc/motd.tail" do
32 apt_preference "cciss-vol-status" do
33 pin "origin *.ubuntu.com"
37 apt_update "/etc/apt/sources.list" do
41 if platform?("debian")
42 archive_host = "deb.debian.org"
43 archive_security_host = archive_host
44 archive_distro = "debian"
45 archive_security_distro = "debian-security"
46 archive_suites = %w[main updates backports security]
47 archive_components = %w[main contrib non-free non-free-firmware]
49 archive_host = if node[:country]
50 "#{node[:country]}.archive.ubuntu.com"
54 archive_security_host = "security.ubuntu.com"
55 archive_distro = "ubuntu"
56 archive_security_distro = archive_distro
57 archive_suites = %w[main updates backports security]
58 archive_components = %w[main restricted universe multiverse]
60 archive_host = "ports.ubuntu.com"
61 archive_security_host = archive_host
62 archive_distro = "ubuntu-ports"
63 archive_security_distro = archive_distro
64 archive_suites = %w[main updates backports security]
65 archive_components = %w[main restricted universe multiverse]
68 template "/etc/apt/sources.list" do
69 source "sources.list.erb"
73 variables :archive_host => archive_host,
74 :archive_security_host => archive_security_host,
75 :archive_distro => archive_distro,
76 :archive_security_distro => archive_security_distro,
77 :archive_suites => archive_suites,
78 :archive_components => archive_components,
79 :codename => node[:lsb][:codename]
80 notifies :update, "apt_update[/etc/apt/sources.list]", :immediately
83 apt_repository "openstreetmap" do
84 uri "https://apt.openstreetmap.org"
86 key "https://apt.openstreetmap.org/gpg.key"
89 package "unattended-upgrades"
91 if Dir.exist?("/usr/share/unattended-upgrades")
92 auto_upgrades = if node[:apt][:unattended_upgrades][:enable]
93 IO.read("/usr/share/unattended-upgrades/20auto-upgrades")
95 IO.read("/usr/share/unattended-upgrades/20auto-upgrades-disabled")
98 file "/etc/apt/apt.conf.d/20auto-upgrades" do
102 content auto_upgrades
106 template "/etc/apt/apt.conf.d/60chef" do
107 source "apt.conf.erb"