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.
24 update-notifier-common
27 file "/etc/motd.tail" do
31 template "/etc/apt/preferences.d/99-chef" do
32 source "preferences.erb"
38 apt_update "/etc/apt/sources.list" do
42 archive_host = if node[:country]
43 "#{node[:country]}.archive.ubuntu.com"
48 template "/etc/apt/sources.list" do
49 source "sources.list.erb"
53 variables :archive_host => archive_host, :codename => node[:lsb][:codename]
54 notifies :update, "apt_update[/etc/apt/sources.list]", :immediately
57 repository_actions = Hash.new do |_, repository|
58 node[:apt][:sources].include?(repository) ? :add : :remove
61 apt_repository "brightbox-ruby-ng" do
62 action repository_actions["brightbox-ruby-ng"]
63 uri "ppa:brightbox/ruby-ng"
66 apt_repository "ubuntugis-stable" do
67 action repository_actions["ubuntugis-stable"]
68 uri "ppa:ubuntugis/ppa"
71 apt_repository "ubuntugis-unstable" do
72 action repository_actions["ubuntugis-unstable"]
73 uri "ppa:ubuntugis/ubuntugis-unstable"
76 apt_repository "git-core" do
77 action repository_actions["git-core"]
78 uri "ppa:git-core/ppa"
81 apt_repository "maxmind" do
82 action repository_actions["maxmind"]
86 apt_repository "openstreetmap" do
87 action repository_actions["openstreetmap"]
88 uri "ppa:osmadmins/ppa"
89 only_if { node[:lsb][:release].to_f < 22.04 }
92 apt_repository "management-component-pack" do
93 action repository_actions["management-component-pack"]
94 uri "https://downloads.linux.hpe.com/SDR/repo/mcp"
95 distribution "bionic/current-gen9"
96 components ["non-free"]
97 key "C208ADDE26C2B797"
100 apt_repository "hwraid" do
101 action repository_actions["hwraid"]
102 uri "https://hwraid.le-vert.net/ubuntu"
103 distribution "precise"
105 key "6005210E23B3D3B4"
108 apt_repository "nginx" do
109 action repository_actions["nginx"]
111 uri "https://nginx.org/packages/ubuntu"
113 key "ABF5BD827BD9BF62"
116 apt_repository "elasticsearch5.x" do
117 action repository_actions["elasticsearch5.x"]
118 uri "https://artifacts.elastic.co/packages/5.x/apt"
119 distribution "stable"
121 key "D27D666CD88E42B4"
124 apt_repository "elasticsearch6.x" do
125 action repository_actions["elasticsearch6.x"]
126 uri "https://artifacts.elastic.co/packages/6.x/apt"
127 distribution "stable"
129 key "D27D666CD88E42B4"
132 apt_repository "passenger" do
133 action repository_actions["passenger"]
134 uri "https://oss-binaries.phusionpassenger.com/apt/passenger"
136 key "561F9B9CAC40B2F7"
139 apt_repository "postgresql" do
140 action repository_actions["postgresql"]
141 uri "https://apt.postgresql.org/pub/repos/apt"
142 distribution "#{node[:lsb][:codename]}-pgdg"
144 key "7FCC7D46ACCC4CF8"
147 apt_repository "docker" do
148 action repository_actions["docker"]
149 uri "https://download.docker.com/linux/ubuntu"
151 components ["stable"]
152 key "https://download.docker.com/linux/ubuntu/gpg"
155 apt_repository "grafana" do
156 action repository_actions["grafana"]
157 uri "https://packages.grafana.com/enterprise/deb"
158 distribution "stable"
160 key "https://packages.grafana.com/gpg.key"
163 apt_repository "timescaledb" do
164 action repository_actions["timescaledb"]
165 uri "https://packagecloud.io/timescale/timescaledb/ubuntu"
167 key "https://packagecloud.io/timescale/timescaledb/gpgkey"
170 package "unattended-upgrades"
172 if Dir.exist?("/usr/share/unattended-upgrades")
173 auto_upgrades = if node[:apt][:unattended_upgrades][:enable]
174 IO.read("/usr/share/unattended-upgrades/20auto-upgrades")
176 IO.read("/usr/share/unattended-upgrades/20auto-upgrades-disabled")
179 file "/etc/apt/apt.conf.d/20auto-upgrades" do
183 content auto_upgrades
187 template "/etc/apt/apt.conf.d/60chef" do
188 source "apt.conf.erb"