]> git.openstreetmap.org Git - chef.git/blob - cookbooks/apt/recipes/default.rb
3cc26880e1430eded3f3a461290c2e8129bf351e
[chef.git] / cookbooks / apt / recipes / default.rb
1 #
2 # Cookbook Name:: apt
3 # Recipe:: default
4 #
5 # Copyright 2010, Tom Hughes
6 #
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
10 #
11 #     https://www.apache.org/licenses/LICENSE-2.0
12 #
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.
18 #
19
20 package %w[
21   apt
22   apt-transport-https
23   gnupg-curl
24   update-notifier-common
25 ]
26
27 file "/etc/motd.tail" do
28   action :delete
29 end
30
31 execute "apt-update" do
32   action :nothing
33   command "/usr/bin/apt-get update"
34 end
35
36 archive_host = if node[:country]
37                  "#{node[:country]}.archive.ubuntu.com"
38                else
39                  "archive.ubuntu.com"
40                end
41
42 template "/etc/apt/sources.list" do
43   source "sources.list.erb"
44   owner "root"
45   group "root"
46   mode 0o644
47   variables :archive_host => archive_host, :codename => node[:lsb][:codename]
48   notifies :run, "execute[apt-update]", :immediately
49 end
50
51 if node[:lsb][:release].to_f >= 16.04
52   apt_source "brightbox-ruby-ng" do
53     action :delete
54   end
55 else
56   apt_source "brightbox-ruby-ng" do
57     url "http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu"
58     key "F5DA5F09C3173AA6"
59   end
60 end
61
62 apt_source "ubuntugis-stable" do
63   url "http://ppa.launchpad.net/ubuntugis/ppa/ubuntu"
64   key "089EBE08314DF160"
65 end
66
67 apt_source "ubuntugis-unstable" do
68   url "http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu"
69   key "089EBE08314DF160"
70 end
71
72 apt_source "openstreetmap" do
73   url "http://ppa.launchpad.net/osmadmins/ppa/ubuntu"
74   key "D57F48750AC4F2CB"
75   update true
76 end
77
78 apt_source "management-component-pack" do
79   source_template "hp.list.erb"
80   url "https://downloads.linux.hpe.com/SDR/repo/mcp"
81   key "C208ADDE26C2B797"
82   key_url "https://downloads.linux.hpe.com/SDR/hpePublicKey2048_key1.pub"
83 end
84
85 apt_source "hwraid" do
86   source_template "hwraid.list.erb"
87   url "https://hwraid.le-vert.net/ubuntu"
88   key "6005210E23B3D3B4"
89 end
90
91 apt_source "mapnik-v210" do
92   url "http://ppa.launchpad.net/mapnik/v2.1.0/ubuntu"
93   key "4F7B93595D50B6BA"
94 end
95
96 apt_source "nginx" do
97   source_template "nginx.list.erb"
98   url "https://nginx.org/packages/ubuntu"
99   key "ABF5BD827BD9BF62"
100 end
101
102 apt_source "elasticsearch1.7" do
103   source_template "elasticsearch.list.erb"
104   url "https://packages.elasticsearch.org/elasticsearch/1.7/debian"
105   key "D27D666CD88E42B4"
106 end
107
108 apt_source "elasticsearch2.x" do
109   source_template "elasticsearch.list.erb"
110   url "https://packages.elasticsearch.org/elasticsearch/2.x/debian"
111   key "D27D666CD88E42B4"
112 end
113
114 apt_source "elasticsearch5.x" do
115   source_template "elasticsearch.list.erb"
116   url "https://artifacts.elastic.co/packages/5.x/apt"
117   key "D27D666CD88E42B4"
118 end
119
120 apt_source "logstash" do
121   source_template "elasticsearch.list.erb"
122   url "https://packages.elasticsearch.org/logstash/2.3/debian"
123   key "D27D666CD88E42B4"
124 end
125
126 apt_source "logstash-forwarder" do
127   source_template "elasticsearch.list.erb"
128   url "https://packages.elasticsearch.org/logstashforwarder/debian"
129   key "D27D666CD88E42B4"
130 end
131
132 apt_source "passenger" do
133   url "https://oss-binaries.phusionpassenger.com/apt/passenger"
134   key "561F9B9CAC40B2F7"
135 end
136
137 apt_source "postgresql" do
138   source_template "postgresql.list.erb"
139   url "https://apt.postgresql.org/pub/repos/apt"
140   key "7FCC7D46ACCC4CF8"
141 end
142
143 apt_source "mediawiki" do
144   source_template "mediawiki.list.erb"
145   url "https://releases.wikimedia.org/debian"
146   key "90E9F83F22250DD7"
147 end
148
149 package "unattended-upgrades"
150
151 if Dir.exist?("/usr/share/unattended-upgrades")
152   auto_upgrades = if node[:apt][:unattended_upgrades][:enable]
153                     IO.read("/usr/share/unattended-upgrades/20auto-upgrades")
154                   else
155                     IO.read("/usr/share/unattended-upgrades/20auto-upgrades-disabled")
156                   end
157
158   file "/etc/apt/apt.conf.d/20auto-upgrades" do
159     user "root"
160     group "root"
161     mode 0o644
162     content auto_upgrades
163   end
164 end
165
166 template "/etc/apt/apt.conf.d/60chef" do
167   source "apt.conf.erb"
168   owner "root"
169   group "root"
170   mode 0o644
171 end