]> git.openstreetmap.org Git - chef.git/blob - cookbooks/apt/recipes/default.rb
Block spam sender
[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 #     http://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 "apt"
21 package "update-notifier-common"
22
23 file "/etc/motd.tail" do
24   action :delete
25 end
26
27 execute "apt-update" do
28   action :nothing
29   command "/usr/bin/apt-get update"
30 end
31
32 archive_host = if node[:country]
33                  "#{node[:country]}.archive.ubuntu.com"
34                else
35                  "archive.ubuntu.com"
36                end
37
38 template "/etc/apt/sources.list" do
39   source "sources.list.erb"
40   owner "root"
41   group "root"
42   mode 0o644
43   variables :archive_host => archive_host, :codename => node[:lsb][:codename]
44   notifies :run, "execute[apt-update]", :immediately
45 end
46
47 if node[:lsb][:release].to_f >= 16.04
48   apt_source "brightbox-ruby-ng" do
49     action :delete
50   end
51 else
52   apt_source "brightbox-ruby-ng" do
53     url "http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu"
54     key "C3173AA6"
55   end
56 end
57
58 apt_source "ubuntugis-stable" do
59   url "http://ppa.launchpad.net/ubuntugis/ppa/ubuntu"
60   key "314DF160"
61 end
62
63 apt_source "ubuntugis-unstable" do
64   url "http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu"
65   key "314DF160"
66 end
67
68 apt_source "openstreetmap" do
69   url "http://ppa.launchpad.net/osmadmins/ppa/ubuntu"
70   key "0AC4F2CB"
71 end
72
73 apt_source "management-component-pack" do
74   template "hp.list.erb"
75   url "http://downloads.linux.hpe.com/SDR/repo/mcp"
76   key "B1275EA3"
77 end
78
79 apt_source "hwraid" do
80   template "hwraid.list.erb"
81   url "http://hwraid.le-vert.net/ubuntu"
82   key "23B3D3B4"
83 end
84
85 apt_source "mapnik-v210" do
86   url "http://ppa.launchpad.net/mapnik/v2.1.0/ubuntu"
87   key "5D50B6BA"
88 end
89
90 apt_source "nginx" do
91   template "nginx.list.erb"
92   url "http://nginx.org/packages/ubuntu"
93   key "7BD9BF62"
94 end
95
96 apt_source "elasticsearch" do
97   template "elasticsearch.list.erb"
98   url "http://packages.elasticsearch.org/elasticsearch/1.7/debian"
99   key "D88E42B4"
100 end
101
102 apt_source "logstash" do
103   template "elasticsearch.list.erb"
104   url "http://packages.elasticsearch.org/logstash/2.3/debian"
105   key "D88E42B4"
106 end
107
108 apt_source "logstash-forwarder" do
109   template "elasticsearch.list.erb"
110   url "http://packages.elasticsearch.org/logstashforwarder/debian"
111   key "D88E42B4"
112 end
113
114 apt_source "passenger" do
115   url "https://oss-binaries.phusionpassenger.com/apt/passenger"
116   key "AC40B2F7"
117 end
118
119 apt_source "postgresql" do
120   template "postgresql.list.erb"
121   url "http://apt.postgresql.org/pub/repos/apt"
122   key "ACCC4CF8"
123 end
124
125 apt_source "mediawiki" do
126   template "mediawiki.list.erb"
127   url "https://releases.wikimedia.org/debian"
128   key "664C383A3566A3481B942F007A322AC6E84AFDD2"
129 end
130
131 package "unattended-upgrades"
132
133 if Dir.exist?("/usr/share/unattended-upgrades")
134   auto_upgrades = if node[:apt][:unattended_upgrades][:enable]
135                     IO.read("/usr/share/unattended-upgrades/20auto-upgrades")
136                   else
137                     IO.read("/usr/share/unattended-upgrades/20auto-upgrades-disabled")
138                   end
139
140   file "/etc/apt/apt.conf.d/20auto-upgrades" do
141     user "root"
142     group "root"
143     mode 0o644
144     content auto_upgrades
145   end
146 end
147
148 template "/etc/apt/apt.conf.d/60chef" do
149   source "apt.conf.erb"
150   owner "root"
151   group "root"
152   mode 0o644
153 end