turn buildd into a real role
[mirror/dsa-puppet.git] / modules / roles / manifests / init.pp
1 # = Class: roles
2 #
3 # Lookup role and include relevant classes for roles
4 #
5 # == Sample Usage:
6 #
7 #   include roles
8 #
9 class roles {
10         if getfromhash($site::nodeinfo, 'not-bacula-client') {
11                 include bacula::not_a_client
12         }
13
14         if has_role('muninmaster') {
15                 include munin::master
16         }
17
18         if has_role('nagiosmaster') {
19                 include nagios::server
20         }
21
22         if has_role('bugs_mirror') {
23                 include roles::bugs_mirror
24         }
25
26         if has_role('bugs_base') {
27                 ssl::service { 'bugs.debian.org':
28                         notify  => Exec['service apache2 reload'],
29                         key => true,
30                 }
31                 ferm::rule { 'dsa-bugs-abusers':
32                         prio    => "005",
33                         rule    => "saddr (220.243.135/24 220.243.136/24) DROP",
34                 }
35         }
36         if has_role('bugs_master') {
37                 ssl::service { 'bugs-devel.debian.org': notify  => Exec['service apache2 reload'], key => true, }
38                 ssl::service { 'bugs-master.debian.org': notify  => Exec['service apache2 reload'], key => true, }
39         }
40
41         if has_role('manpages-dyn') {
42                 include roles::manpages_dyn
43         }
44
45         if has_role('archvsync_base_additional') {
46                 include archvsync_base
47         }
48
49         # archive.debian.org
50         if has_role('historical_mirror') {
51                 include roles::historical_mirror
52         }
53
54         # debug archive
55         if has_role('debug_mirror') {
56                 include roles::debug_mirror
57         }
58
59         # ftp.debian.org and its ecosystem
60         if has_role('debian_mirror') {
61                 include roles::debian_mirror
62         }
63         if has_role('ftp_master') {
64                 include roles::ftp_master
65                 include roles::dakmaster
66                 include roles::signing
67         }
68         if has_role('ftp.upload.d.o') {
69                 include roles::ftp_upload
70         }
71         if has_role('ssh.upload.d.o') {
72                 include roles::ssh_upload
73         }
74         if has_role('security_upload') {
75                 include roles::security_upload
76         }
77         if has_role('api.ftp-master') {
78                 ssl::service { 'api.ftp-master.debian.org':
79                         notify  => Exec['service apache2 reload'],
80                         key => true,
81                 }
82         }
83         #
84         # security.debian.org
85         if has_role('security_master') {
86                 include roles::security_master
87                 include roles::dakmaster
88         }
89
90         if has_role('security_mirror') {
91                 include roles::security_mirror
92         }
93
94         if has_role('git_master') {
95                 include roles::git_master
96         }
97
98         if has_role('people') {
99                 ssl::service { 'people.debian.org': notify  => Exec['service apache2 reload'], key => true, }
100                 onion::service { 'people.debian.org': port => 80, target_address => 'people.debian.org', target_port => 80, direct => true }
101         }
102
103         if has_role('www_master') {
104                 include roles::www_master
105         }
106
107         if has_role('cgi.d.o') {
108                 ssl::service { 'cgi.debian.org': notify  => Exec['service apache2 reload'], key => true, }
109         }
110
111         if has_role('keyring') {
112                 include roles::keyring
113         }
114
115         if has_role('wiki') {
116                 include roles::wiki
117         }
118
119         if has_role('syncproxy') {
120                 include roles::syncproxy
121         }
122
123         if has_role('static_master') {
124                 include roles::static_master
125         }
126
127         if has_role('static_mirror') {
128                 include roles::static_mirror
129         } elsif has_role('static_source') {
130                 include roles::static_source
131         }
132
133         if has_role('weblog_provider') {
134                 include roles::weblog_provider
135         }
136
137         if has_role('mailrelay') {
138                 include roles::mailrelay
139         }
140
141         if has_role('pubsub') {
142                 include roles::pubsub
143         }
144
145         if has_role('dbmaster') {
146                 include roles::dbmaster
147         }
148
149         if has_role('dns_primary') {
150                 include roles::dns_primary
151         }
152
153         if has_role('dns_geo') {
154                 include roles::dns_geodns
155         }
156
157         if has_role('weblog_destination') {
158                 include roles::weblog_destination
159         }
160
161         if has_role('vote') {
162                 include roles::vote
163         }
164
165         if has_role('security_tracker') {
166                 include roles::security_tracker
167         }
168
169         if has_role('lists') {
170                 include roles::lists
171         }
172
173         if has_role('rtmaster') {
174                 include roles::rtmaster
175         }
176
177         if has_role('udd') {
178                 include roles::udd
179         }
180
181         if has_role('sso') {
182                 include roles::sso
183         }
184
185         if has_role('sso_rp') {
186                 include roles::sso_rp
187         }
188
189         if has_role('tracker') {
190                 include roles::tracker
191         }
192
193         if has_role('piuparts') {
194                 include roles::piuparts
195         }
196         if has_role('piuparts_slave') {
197                 include roles::piuparts_slave
198         }
199
200         if has_role('contributors') {
201                 include roles::contributors
202         }
203
204         if has_role('nm') {
205                 include roles::nm
206         }
207
208         if has_role('rtc') {
209                 include roles::rtc
210         }
211
212         if has_role('jenkins') {
213                 include roles::jenkins
214         }
215
216         if has_role('postgres_backup_server') {
217                 include postgres::backup_server
218         }
219
220         if has_role('packages') {
221                 ssl::service { 'packages.debian.org': notify  => Exec['service apache2 reload'], key => true, }
222         }
223
224         if has_role('historicalpackages') {
225                 ssl::service { 'historical.packages.debian.org': notify  => Exec['service apache2 reload'], key => true, }
226         }
227
228         if has_role('qamaster') {
229                 ssl::service { 'qa.debian.org': notify  => Exec['service apache2 reload'], key => true, }
230         }
231
232         if has_role('packagesqamaster') {
233                 ssl::service { 'packages.qa.debian.org': notify  => Exec['service apache2 reload'], key => true, }
234         }
235
236         if has_role('gobby_debian_org') {
237                 ssl::service { 'gobby.debian.org':
238                         notify  => [ Exec['service apache2 reload'], Exec['reload gobby'] ],
239                         key => true,
240                         tlsaport => [443, 6523],
241                 }
242                 file { '/etc/ssl/debian-local/other-keys/gobby.debian.org.key':
243                         ensure => present,
244                         mode => '0440',
245                         group => 'gobby',
246                         content => inline_template('<%= File.read(scope().call_function("hiera", ["paths.letsencrypt_dir"]) + "/gobby.debian.org.key") %>'),
247                         links => follow,
248                         notify => Exec['reload gobby'],
249                 }
250                 exec { 'reload gobby':
251                         command => 'pkill -u gobby -HUP -x infinoted',
252                         refreshonly => true,
253                 }
254         }
255
256         if has_role('search_backend') {
257                 include roles::search_backend
258         }
259         if has_role('search_frontend') {
260                 include roles::search_frontend
261         }
262
263         if has_role('dgit_browse') {
264                 include roles::dgit_browse
265         }
266         if has_role('dgit_git') {
267                 include roles::dgit_git
268         }
269
270         if $::hostname in [lw01, lw02, lw03, lw04, lw09, lw10] {
271                 include roles::snapshot
272         }
273
274         if has_role('snapshot_web') {
275                 include roles::snapshot_web
276         }
277
278         if has_role('snapshot_shell') {
279                 include roles::snapshot_shell
280         }
281
282         if has_role('veyepar.debian.org') {
283                 include roles::veyepar
284         }
285         if has_role('sreview.debian.org') {
286                 include roles::sreview
287         }
288
289         if has_role('debtags') {
290                 include roles::debtags
291         }
292
293         if has_role('planet_master') {
294                 include roles::planet_master
295         }
296         if has_role('planet_search') {
297                 ssl::service { 'planet-search.debian.org': notify  => Exec['service apache2 reload'], key => true, }
298         }
299
300         if has_role('i18n.d.o') {
301                 ssl::service { 'i18n.debian.org': notify  => Exec['service apache2 reload'], key => true, }
302         }
303
304         if has_role('l10n.d.o') {
305                 ssl::service { 'l10n.debian.org': notify  => Exec['service apache2 reload'], key => true, }
306         }
307
308         if has_role('dedup.d.n') {
309                 ssl::service { 'dedup.debian.net': notify  => Exec['service apache2 reload'], key => true, }
310         }
311
312         if has_role('pet.d.n') {
313                 ssl::service { 'pet.debian.net': notify  => Exec['service apache2 reload'], key => true, }
314                 ssl::service { 'pet-devel.debian.net': notify  => Exec['service apache2 reload'], key => true, }
315         }
316
317         if has_role('ports_master') {
318                 include roles::ports_master
319         }
320         if has_role('ports_mirror') {
321                 include roles::ports_mirror
322         }
323
324         if has_role('onionbalance') {
325                 include onion::balance
326         }
327         if has_role('bgp') {
328                 include roles::bgp
329         }
330         if has_role('cdimage-search') {
331                 include roles::cdimage_search
332         }
333
334         if has_role('postgresql_server') {
335                 include postgres::backup_source
336         }
337
338         if has_role('bacula_director') {
339                 include bacula::director
340         } else {
341                 package { 'bacula-console': ensure => purged; }
342                 file { '/etc/bacula/bconsole.conf': ensure => absent; }
343         }
344         if has_role('bacula_storage') {
345                 include bacula::storage
346         }
347
348         if has_role('salsa.debian.org') {
349                 include salsa
350         }
351
352         if $::keyring_debian_org_mirror {
353                 include roles::keyring_debian_org_mirror
354         }
355
356         if has_role('popcon') {
357                 include roles::popcon
358         }
359
360         if has_role('debsources') {
361                 include roles::debsources
362         }
363
364         if has_role('ipsec') {
365                 include ipsec
366         }
367
368         if has_role('debconf_wafer') {
369                 include roles::debconf_wafer
370         }
371
372         if has_role('cdbuilder_local_mirror') {
373                 include roles::cdbuilder_local_mirror
374         }
375
376         if has_role('alioth_archive') {
377                 include roles::alioth_archive
378         }
379         if has_role('anonscm') {
380                 include roles::anonscm
381         }
382 }