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 "openstreetmap" do
77 action repository_actions["openstreetmap"]
78 uri "ppa:osmadmins/ppa"
81 apt_repository "squid2" do
82 action repository_actions["squid2"]
83 uri "ppa:osmadmins/squid2"
86 apt_repository "squid3" do
87 action repository_actions["squid3"]
88 uri "ppa:osmadmins/squid3"
91 apt_repository "squid4" do
92 action repository_actions["squid4"]
93 uri "ppa:osmadmins/squid4"
96 apt_repository "management-component-pack" do
97 action repository_actions["management-component-pack"]
98 uri "https://downloads.linux.hpe.com/SDR/repo/mcp"
99 distribution "#{node[:lsb][:codename]}/current-gen9"
100 components ["non-free"]
101 key "C208ADDE26C2B797"
104 apt_repository "hwraid" do
105 action repository_actions["hwraid"]
106 uri "https://hwraid.le-vert.net/ubuntu"
107 distribution "precise"
109 key "6005210E23B3D3B4"
112 apt_repository "nginx" do
113 action repository_actions["nginx"]
115 uri "https://nginx.org/packages/ubuntu"
117 key "ABF5BD827BD9BF62"
120 apt_repository "elasticsearch5.x" do
121 action repository_actions["elasticsearch5.x"]
122 uri "https://artifacts.elastic.co/packages/5.x/apt"
123 distribution "stable"
125 key "D27D666CD88E42B4"
128 apt_repository "elasticsearch6.x" do
129 action repository_actions["elasticsearch6.x"]
130 uri "https://artifacts.elastic.co/packages/6.x/apt"
131 distribution "stable"
133 key "D27D666CD88E42B4"
136 apt_repository "passenger" do
137 action repository_actions["passenger"]
138 uri "https://oss-binaries.phusionpassenger.com/apt/passenger"
140 key "561F9B9CAC40B2F7"
143 apt_repository "postgresql" do
144 action repository_actions["postgresql"]
145 uri "https://apt.postgresql.org/pub/repos/apt"
146 distribution "#{node[:lsb][:codename]}-pgdg"
148 key "7FCC7D46ACCC4CF8"
151 apt_repository "mediawiki" do
152 action repository_actions["mediawiki"]
153 uri "https://releases.wikimedia.org/debian"
154 distribution "jessie-mediawiki"
156 key "90E9F83F22250DD7"
159 package "unattended-upgrades"
161 if Dir.exist?("/usr/share/unattended-upgrades")
162 auto_upgrades = if node[:apt][:unattended_upgrades][:enable]
163 IO.read("/usr/share/unattended-upgrades/20auto-upgrades")
165 IO.read("/usr/share/unattended-upgrades/20auto-upgrades-disabled")
168 file "/etc/apt/apt.conf.d/20auto-upgrades" do
172 content auto_upgrades
176 template "/etc/apt/apt.conf.d/60chef" do
177 source "apt.conf.erb"