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.
23 update-notifier-common
26 if node[:lsb][:release].to_f < 18.04
30 file "/etc/motd.tail" do
34 apt_update "/etc/apt/sources.list" do
38 archive_host = if node[:country]
39 "#{node[:country]}.archive.ubuntu.com"
44 template "/etc/apt/sources.list" do
45 source "sources.list.erb"
49 variables :archive_host => archive_host, :codename => node[:lsb][:codename]
50 notifies :update, "apt_update[/etc/apt/sources.list]", :immediately
53 repository_actions = Hash.new do |_, repository|
54 node[:apt][:sources].include?(repository) ? :add : :remove
57 apt_repository "brightbox-ruby-ng" do
58 action repository_actions["brightbox-ruby-ng"]
59 uri "ppa:brightbox/ruby-ng"
62 apt_repository "ubuntugis-stable" do
63 action repository_actions["ubuntugis-stable"]
64 uri "ppa:ubuntugis/ppa"
67 apt_repository "ubuntugis-unstable" do
68 action repository_actions["ubuntugis-unstable"]
69 uri "ppa:ubuntugis/ubuntugis-unstable"
72 apt_repository "openstreetmap" do
73 action repository_actions["openstreetmap"]
74 uri "ppa:osmadmins/ppa"
77 apt_repository "squid2" do
78 action repository_actions["squid2"]
79 uri "ppa:osmadmins/squid2"
82 apt_repository "squid3" do
83 action repository_actions["squid3"]
84 uri "ppa:osmadmins/squid3"
87 apt_repository "management-component-pack" do
88 action repository_actions["management-component-pack"]
89 uri "https://downloads.linux.hpe.com/SDR/repo/mcp"
90 if node[:lsb][:release].to_f >= 16.04
91 distribution "xenial/current"
93 distribution "#{node[:lsb][:codename]}/current"
95 components ["non-free"]
96 key "C208ADDE26C2B797"
99 apt_repository "hwraid" do
100 action repository_actions["hwraid"]
101 uri "https://hwraid.le-vert.net/ubuntu"
102 distribution "precise"
104 key "6005210E23B3D3B4"
107 apt_repository "nginx" do
108 action repository_actions["nginx"]
109 uri "https://nginx.org/packages/ubuntu"
111 key "ABF5BD827BD9BF62"
114 apt_repository "elasticsearch5.x" do
115 action repository_actions["elasticsearch5.x"]
116 uri "https://artifacts.elastic.co/packages/5.x/apt"
117 distribution "stable"
119 key "D27D666CD88E42B4"
122 apt_repository "elasticsearch6.x" do
123 action repository_actions["elasticsearch6.x"]
124 uri "https://artifacts.elastic.co/packages/6.x/apt"
125 distribution "stable"
127 key "D27D666CD88E42B4"
130 apt_repository "passenger" do
131 action repository_actions["passenger"]
132 uri "https://oss-binaries.phusionpassenger.com/apt/passenger"
134 key "561F9B9CAC40B2F7"
137 apt_repository "postgresql" do
138 action repository_actions["postgresql"]
139 uri "https://apt.postgresql.org/pub/repos/apt"
140 distribution "#{node[:lsb][:codename]}-pgdg"
142 key "7FCC7D46ACCC4CF8"
145 apt_repository "mediawiki" do
146 action repository_actions["mediawiki"]
147 uri "https://releases.wikimedia.org/debian"
148 distribution "jessie-mediawiki"
150 key "90E9F83F22250DD7"
153 package "unattended-upgrades"
155 if Dir.exist?("/usr/share/unattended-upgrades")
156 auto_upgrades = if node[:apt][:unattended_upgrades][:enable]
157 IO.read("/usr/share/unattended-upgrades/20auto-upgrades")
159 IO.read("/usr/share/unattended-upgrades/20auto-upgrades-disabled")
162 file "/etc/apt/apt.conf.d/20auto-upgrades" do
166 content auto_upgrades
170 template "/etc/apt/apt.conf.d/60chef" do
171 source "apt.conf.erb"