]> git.openstreetmap.org Git - chef.git/blob - cookbooks/apt/recipes/default.rb
Make exim trust the rails users on all web machines
[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
24   update-notifier-common
25 ]
26
27 file "/etc/motd.tail" do
28   action :delete
29 end
30
31 apt_update "/etc/apt/sources.list" do
32   action :nothing
33 end
34
35 archive_host = if node[:country]
36                  "#{node[:country]}.archive.ubuntu.com"
37                else
38                  "archive.ubuntu.com"
39                end
40
41 template "/etc/apt/sources.list" do
42   source "sources.list.erb"
43   owner "root"
44   group "root"
45   mode 0o644
46   variables :archive_host => archive_host, :codename => node[:lsb][:codename]
47   notifies :update, "apt_update[/etc/apt/sources.list]", :immediately
48 end
49
50 repository_actions = Hash.new do |_, repository|
51   node[:apt][:sources].include?(repository) ? :add : :remove
52 end
53
54 apt_repository "brightbox-ruby-ng" do
55   action repository_actions["brightbox-ruby-ng"]
56   uri "ppa:brightbox/ruby-ng"
57 end
58
59 apt_repository "ubuntugis-stable" do
60   action repository_actions["ubuntugis-stable"]
61   uri "ppa:ubuntugis/ppa"
62 end
63
64 apt_repository "ubuntugis-unstable" do
65   action repository_actions["ubuntugis-unstable"]
66   uri "ppa:ubuntugis/ubuntugis-unstable"
67 end
68
69 apt_repository "openstreetmap" do
70   action repository_actions["openstreetmap"]
71   uri "ppa:osmadmins/ppa"
72 end
73
74 apt_repository "squid2" do
75   action repository_actions["squid2"]
76   uri "ppa:osmadmins/squid2"
77 end
78
79 apt_repository "squid3" do
80   action repository_actions["squid3"]
81   uri "ppa:osmadmins/squid3"
82 end
83
84 apt_repository "management-component-pack" do
85   action repository_actions["management-component-pack"]
86   uri "https://downloads.linux.hpe.com/SDR/repo/mcp"
87   distribution "#{node[:lsb][:codename]}/current-gen9"
88   components ["non-free"]
89   key "C208ADDE26C2B797"
90 end
91
92 apt_repository "hwraid" do
93   action repository_actions["hwraid"]
94   uri "https://hwraid.le-vert.net/ubuntu"
95   distribution "precise"
96   components ["main"]
97   key "6005210E23B3D3B4"
98 end
99
100 apt_repository "nginx" do
101   action repository_actions["nginx"]
102   arch "amd64"
103   uri "https://nginx.org/packages/ubuntu"
104   components ["nginx"]
105   key "ABF5BD827BD9BF62"
106 end
107
108 apt_repository "elasticsearch5.x" do
109   action repository_actions["elasticsearch5.x"]
110   uri "https://artifacts.elastic.co/packages/5.x/apt"
111   distribution "stable"
112   components ["main"]
113   key "D27D666CD88E42B4"
114 end
115
116 apt_repository "elasticsearch6.x" do
117   action repository_actions["elasticsearch6.x"]
118   uri "https://artifacts.elastic.co/packages/6.x/apt"
119   distribution "stable"
120   components ["main"]
121   key "D27D666CD88E42B4"
122 end
123
124 apt_repository "passenger" do
125   action repository_actions["passenger"]
126   uri "https://oss-binaries.phusionpassenger.com/apt/passenger"
127   components ["main"]
128   key "561F9B9CAC40B2F7"
129 end
130
131 apt_repository "postgresql" do
132   action repository_actions["postgresql"]
133   uri "https://apt.postgresql.org/pub/repos/apt"
134   distribution "#{node[:lsb][:codename]}-pgdg"
135   components ["main"]
136   key "7FCC7D46ACCC4CF8"
137 end
138
139 apt_repository "mediawiki" do
140   action repository_actions["mediawiki"]
141   uri "https://releases.wikimedia.org/debian"
142   distribution "jessie-mediawiki"
143   components ["main"]
144   key "90E9F83F22250DD7"
145 end
146
147 package "unattended-upgrades"
148
149 if Dir.exist?("/usr/share/unattended-upgrades")
150   auto_upgrades = if node[:apt][:unattended_upgrades][:enable]
151                     IO.read("/usr/share/unattended-upgrades/20auto-upgrades")
152                   else
153                     IO.read("/usr/share/unattended-upgrades/20auto-upgrades-disabled")
154                   end
155
156   file "/etc/apt/apt.conf.d/20auto-upgrades" do
157     user "root"
158     group "root"
159     mode 0o644
160     content auto_upgrades
161   end
162 end
163
164 template "/etc/apt/apt.conf.d/60chef" do
165   source "apt.conf.erb"
166   owner "root"
167   group "root"
168   mode 0o644
169 end