35c277a397d5e27304aa709b220e2d25c7ff8d6c
[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         if has_role('manpages-dyn') {
19                 include roles::manpages_dyn
20         }
21
22         # archive.debian.org
23         if has_role('historical_mirror') {
24                 include roles::historical_mirror
25         }
26
27         # debug archive
28         if has_role('debug_mirror') {
29                 include roles::debug_mirror
30         }
31
32         # ftp.debian.org and its ecosystem
33         if has_role('debian_mirror') {
34                 include roles::debian_mirror
35         }
36         if has_role('ftp_master') {
37                 include roles::ftp_master
38                 include roles::dakmaster
39                 include roles::signing
40         }
41         if has_role('ftp.upload.d.o') {
42                 include roles::ftp_upload
43         }
44         if has_role('ssh.upload.d.o') {
45                 include roles::ssh_upload
46         }
47         if has_role('security_upload') {
48                 include roles::security_upload
49         }
50         if has_role('api.ftp-master') {
51                 ssl::service { 'api.ftp-master.debian.org':
52                         notify  => Exec['service apache2 reload'],
53                         key => true,
54                 }
55         }
56         #
57         # security.debian.org
58         if has_role('security_master') {
59                 include roles::security_master
60                 include roles::dakmaster
61         }
62
63         if has_role('security_mirror') {
64                 include roles::security_mirror
65         }
66
67         if has_role('git_master') {
68                 include roles::git_master
69         }
70
71         if has_role('people') {
72                 ssl::service { 'people.debian.org': notify  => Exec['service apache2 reload'], key => true, }
73                 onion::service { 'people.debian.org': port => 80, target_address => 'people.debian.org', target_port => 80, direct => true }
74         }
75
76         if has_role('www_master') {
77                 include roles::www_master
78         }
79
80         if has_role('cgi.d.o') {
81                 ssl::service { 'cgi.debian.org': notify  => Exec['service apache2 reload'], key => true, }
82         }
83
84         if has_role('wiki') {
85                 include roles::wiki
86         }
87
88         if has_role('syncproxy') {
89                 include roles::syncproxy
90         }
91
92         if has_role('mailrelay') {
93                 include roles::mailrelay
94         }
95
96         if has_role('pubsub') {
97                 include roles::pubsub
98         }
99
100         if has_role('dbmaster') {
101                 include roles::dbmaster
102         }
103
104         if has_role('dns_primary') {
105                 include roles::dns_primary
106         }
107
108         if has_role('dns_geo') {
109                 include roles::dns_geodns
110         }
111
112         if has_role('security_tracker') {
113                 include roles::security_tracker
114         }
115
116         if has_role('rtmaster') {
117                 include roles::rtmaster
118         }
119
120         if has_role('udd') {
121                 include roles::udd
122         }
123
124         if has_role('sso') {
125                 include roles::sso
126         }
127
128         if has_role('sso_rp') {
129                 include roles::sso_rp
130         }
131
132         if has_role('tracker') {
133                 include roles::tracker
134         }
135
136         if has_role('piuparts') {
137                 include roles::piuparts
138         }
139         if has_role('piuparts_slave') {
140                 include roles::piuparts_slave
141         }
142
143         if has_role('contributors') {
144                 include roles::contributors
145         }
146
147         if has_role('nm') {
148                 include roles::nm
149         }
150
151         if has_role('postgres_backup_server') {
152                 include postgres::backup_server
153         }
154
155         if has_role('packages') {
156                 ssl::service { 'packages.debian.org': notify  => Exec['service apache2 reload'], key => true, }
157         }
158
159         if has_role('historicalpackages') {
160                 ssl::service { 'historical.packages.debian.org': notify  => Exec['service apache2 reload'], key => true, }
161         }
162
163         if has_role('qamaster') {
164                 ssl::service { 'qa.debian.org': notify  => Exec['service apache2 reload'], key => true, }
165         }
166
167         if has_role('packagesqamaster') {
168                 ssl::service { 'packages.qa.debian.org': notify  => Exec['service apache2 reload'], key => true, }
169         }
170
171         if has_role('gobby_debian_org') {
172                 ssl::service { 'gobby.debian.org':
173                         notify  => [ Exec['service apache2 reload'], Exec['reload gobby'] ],
174                         key => true,
175                         tlsaport => [443, 6523],
176                 }
177                 file { '/etc/ssl/debian-local/other-keys/gobby.debian.org.key':
178                         ensure => present,
179                         mode => '0440',
180                         group => 'gobby',
181                         content => inline_template('<%= File.read(scope().call_function("hiera", ["paths.letsencrypt_dir"]) + "/gobby.debian.org.key") %>'),
182                         links => follow,
183                         notify => Exec['reload gobby'],
184                 }
185                 exec { 'reload gobby':
186                         command => 'pkill -u gobby -HUP -x infinoted',
187                         refreshonly => true,
188                 }
189         }
190
191         if has_role('search_backend') {
192                 include roles::search_backend
193         }
194         if has_role('search_frontend') {
195                 include roles::search_frontend
196         }
197
198         if has_role('dgit_browse') {
199                 include roles::dgit_browse
200         }
201         if has_role('dgit_git') {
202                 include roles::dgit_git
203         }
204
205         if $::hostname in [lw01, lw02, lw03, lw04, lw09, lw10] {
206                 include roles::snapshot
207         }
208
209         if has_role('snapshot_web') {
210                 include roles::snapshot_web
211         }
212
213         if has_role('snapshot_shell') {
214                 include roles::snapshot_shell
215         }
216
217         if has_role('debtags') {
218                 include roles::debtags
219         }
220
221         if has_role('planet_master') {
222                 include roles::planet_master
223         }
224         if has_role('planet_search') {
225                 ssl::service { 'planet-search.debian.org': notify  => Exec['service apache2 reload'], key => true, }
226         }
227
228         if has_role('i18n.d.o') {
229                 ssl::service { 'i18n.debian.org': notify  => Exec['service apache2 reload'], key => true, }
230         }
231
232         if has_role('l10n.d.o') {
233                 ssl::service { 'l10n.debian.org': notify  => Exec['service apache2 reload'], key => true, }
234         }
235
236         if has_role('dedup.d.n') {
237                 ssl::service { 'dedup.debian.net': notify  => Exec['service apache2 reload'], key => true, }
238         }
239
240         if has_role('pet.d.n') {
241                 ssl::service { 'pet.debian.net': notify  => Exec['service apache2 reload'], key => true, }
242                 ssl::service { 'pet-devel.debian.net': notify  => Exec['service apache2 reload'], key => true, }
243         }
244
245         if has_role('ports_master') {
246                 include roles::ports_master
247         }
248         if has_role('ports_mirror') {
249                 include roles::ports_mirror
250         }
251
252         if has_role('onionbalance') {
253                 include onion::balance
254         }
255         if has_role('bgp') {
256                 include roles::bgp
257         }
258         if has_role('cdimage-search') {
259                 include roles::cdimage_search
260         }
261
262         if has_role('postgresql_server') {
263                 include postgres::backup_source
264         }
265
266         if has_role('bacula_director') {
267                 include bacula::director
268         } else {
269                 package { 'bacula-console': ensure => purged; }
270                 file { '/etc/bacula/bconsole.conf': ensure => absent; }
271         }
272         if has_role('bacula_storage') {
273                 include bacula::storage
274         }
275
276         if $::keyring_debian_org_mirror {
277                 include roles::keyring_debian_org_mirror
278         }
279
280         if has_role('popcon') {
281                 include roles::popcon
282         }
283
284         if has_role('debsources') {
285                 include roles::debsources
286         }
287 }