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