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