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