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 # FIXME: cleanup old package pin method for cciss-vol-status
33 file "/etc/apt/preferences.d/99-chef" do
37 apt_preference "cciss-vol-status" do
38 pin "origin *.ubuntu.com"
42 apt_update "/etc/apt/sources.list" do
46 if platform?("debian")
47 archive_host = "deb.debian.org"
48 archive_security_host = archive_host
49 archive_distro = "debian"
50 archive_security_distro = "debian-security"
51 archive_suites = %w[main updates security]
52 archive_components = %w[main contrib non-free non-free-firmware]
54 archive_host = if node[:country]
55 "#{node[:country]}.archive.ubuntu.com"
59 archive_security_host = "security.ubuntu.com"
60 archive_distro = "ubuntu"
61 archive_security_distro = archive_distro
62 archive_suites = %w[main updates backports security]
63 archive_components = %w[main restricted universe multiverse]
65 archive_host = "ports.ubuntu.com"
66 archive_security_host = archive_host
67 archive_distro = "ubuntu-ports"
68 archive_security_distro = archive_distro
69 archive_suites = %w[main updates backports security]
70 archive_components = %w[main restricted universe multiverse]
73 template "/etc/apt/sources.list" do
74 source "sources.list.erb"
78 variables :archive_host => archive_host,
79 :archive_security_host => archive_security_host,
80 :archive_distro => archive_distro,
81 :archive_security_distro => archive_security_distro,
82 :archive_suites => archive_suites,
83 :archive_components => archive_components,
84 :codename => node[:lsb][:codename]
85 notifies :update, "apt_update[/etc/apt/sources.list]", :immediately
88 apt_repository "openstreetmap" do
89 uri "ppa:osmadmins/ppa"
90 only_if { platform?("ubuntu") }
93 package "unattended-upgrades"
95 if Dir.exist?("/usr/share/unattended-upgrades")
96 auto_upgrades = if node[:apt][:unattended_upgrades][:enable]
97 IO.read("/usr/share/unattended-upgrades/20auto-upgrades")
99 IO.read("/usr/share/unattended-upgrades/20auto-upgrades-disabled")
102 file "/etc/apt/apt.conf.d/20auto-upgrades" do
106 content auto_upgrades
110 template "/etc/apt/apt.conf.d/60chef" do
111 source "apt.conf.erb"