Split the web stuff out of the static_mirror role
[mirror/dsa-puppet.git] / modules / roles / manifests / static_mirror_web.pp
1 # a static web mirror
2 class roles::static_mirror_web {
3   include roles::static_mirror
4
5   include apache2::expires
6   include apache2::rewrite
7
8   package { 'libapache2-mod-geoip': ensure => installed, }
9   package { 'geoip-database': ensure => installed, }
10
11   include apache2::ssl
12   apache2::module { 'include': }
13   apache2::module { 'geoip': require => [Package['libapache2-mod-geoip'], Package['geoip-database']]; }
14   apache2::module { 'deflate': }
15   apache2::module { 'filter': }
16
17   $onion_v4_addr = $::hostname ? {
18     klecker    => '130.89.148.14',
19     mirror-isc => '149.20.4.15',
20     senfter    => '5.153.231.4',
21     default    => undef,
22   }
23   $vhost_listen = $::hostname ? {
24     klecker    => '130.89.148.14:80 [2001:67c:2564:a119::148:14]:80',
25     mirror-isc => '149.20.4.15:80 [2001:4f8:1:c::15]:80',
26     mirror-anu => '150.203.164.62:80 [2001:388:1034:2900::3e]:80',
27     default    => '*:80',
28   }
29   $vhost_listen_443 = $::hostname ? {
30     klecker    => '130.89.148.14:443 [2001:67c:2564:a119::148:14]:443',
31     mirror-isc => '149.20.4.15:443 [2001:4f8:1:c::15]:443',
32     mirror-anu => '150.203.164.62:443 [2001:388:1034:2900::3e]:443',
33     default    => '*:443',
34   }
35   $redirect_vhosts = true
36
37   apache2::config { 'local-static-vhost.conf':
38     ensure => absent,
39   }
40   apache2::config { 'local-static-vhost':
41     content => template('roles/static-mirroring/static-vhost.conf.erb'),
42   }
43
44   apache2::site { '010-planet.debian.org':
45     site    => 'planet.debian.org',
46     ensure  => has_static_component('planet.debian.org') ? { true => 'present', false => 'absent' },
47     content => template('roles/static-mirroring/vhost/planet.debian.org.erb'),
48   }
49
50   apache2::site { '010-lintian.debian.org':
51     site    => 'lintian.debian.org',
52     ensure  => absent,
53   }
54
55   apache2::site { '010-static-vhosts-00-manpages':
56     site   => 'static-manpages.debian.org',
57     ensure  => has_static_component('manpages.debian.org') ? { true => 'present', false => 'absent' },
58     content => template('roles/static-mirroring/vhost/manpages.debian.org.erb'),
59   }
60   apache2::site { '010-static-vhosts-simple':
61     site => 'static-vhosts-simple',
62     content => template('roles/static-mirroring/vhost/static-vhosts-simple.erb'),
63   }
64
65   $wwwdo_server_name = 'www.debian.org'
66   $wwwdo_document_root = '/srv/static.debian.org/mirrors/www.debian.org/cur'
67   apache2::site { '005-www.debian.org':
68     site   => 'www.debian.org',
69     ensure  => has_static_component('www.debian.org') ? { true => 'present', false => 'absent' },
70     content => template('roles/apache-www.debian.org.erb'),
71   }
72
73   ssl::service { 'www.debian.org'      : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
74   ssl::service { 'debian.org' :
75     ensure  => has_static_component('www.debian.org') ? { true => 'present', false => 'absent' },
76     notify  => Exec['service apache2 reload'],
77     key => true,
78   }
79
80   # do
81   ssl::service { 'appstream.debian.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
82   ssl::service { 'backports.debian.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
83   ssl::service { 'bits.debian.org'               : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
84   ssl::service { 'blends.debian.org'             : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
85   ssl::service { 'cdbuilder-logs.debian.org'     : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
86   ssl::service { 'd-i.debian.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
87   ssl::service { 'deb.debian.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
88   ssl::service { 'dpl.debian.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
89   ssl::service { 'dsa.debian.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
90   ssl::service { 'incoming.debian.org'           : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
91   ssl::service { 'incoming.ports.debian.org'     : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
92   ssl::service { 'lintian.debian.org'            : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
93   ssl::service { 'lists.alioth.debian.org'       : ensure => 'present',  notify  => Exec['service apache2 reload'], key => true, }
94   ssl::service { 'manpages.debian.org'           : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
95   ssl::service { 'metadata-backend.ftp-master.debian.org':
96     ensure => has_static_component('metadata.ftp-master.debian.org') ? { true => 'present', false => 'absent' },
97     notify  => Exec['service apache2 reload'],
98     key => true,
99   }
100   ssl::service { 'mirror-master.debian.org'      : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
101   ssl::service { 'onion.debian.org'              : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
102   ssl::service { 'openpgpkey.debian.org'         : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
103   ssl::service { 'pkg-ruby-extras.alioth.debian.org' : ensure => 'present',  notify  => Exec['service apache2 reload'], key => true, }
104   ssl::service { 'planet-backend.debian.org'     :
105     ensure => has_static_component('planet.debian.org') ? { true => 'present', false => 'absent' },
106     notify => Exec['service apache2 reload'],
107     key    => true,
108   }
109   ssl::service { 'release.debian.org'            : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
110   ssl::service { 'rtc.debian.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true }
111   ssl::service { 'security-team.debian.org'      : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
112   ssl::service { 'www.ports.debian.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
113   # dn
114   ssl::service { 'bootstrap.debian.net'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
115   ssl::service { 'debaday.debian.net'            : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
116   ssl::service { 'debdeltas.debian.net'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
117   ssl::service { 'micronews.debian.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
118   ssl::service { 'mozilla.debian.net'            : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
119   ssl::service { 'news.debian.net'               : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
120   ssl::service { 'sources.debian.net'            : ensure => 'present',  notify  => Exec['service apache2 reload'], key => true, }
121   ssl::service { 'timeline.debian.net'           : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
122   ssl::service { 'video.debian.net'              : ensure => 'present',  notify  => Exec['service apache2 reload'], key => true, }
123   ssl::service { 'wnpp-by-tags.debian.net'       : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
124   # dc
125   ssl::service { 'debconf.org'                   : ensure => 'present', notify  => Exec['service apache2 reload'], key => true, }
126   ssl::service { '10years.debconf.org'           : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
127   ssl::service { 'debconf0.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
128   ssl::service { 'debconf1.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
129   ssl::service { 'debconf16.debconf.org'         : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
130   ssl::service { 'debconf17.debconf.org'         : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
131   ssl::service { 'debconf18.debconf.org'         : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
132   ssl::service { 'debconf19.debconf.org'         : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
133   ssl::service { 'debconf2.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
134   ssl::service { 'debconf3.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
135   ssl::service { 'debconf4.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
136   ssl::service { 'debconf5.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
137   ssl::service { 'debconf6.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
138   ssl::service { 'debconf7.debconf.org'          : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
139   ssl::service { 'es.debconf.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
140   ssl::service { 'fr.debconf.org'                : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
141   ssl::service { 'miniconf10.debconf.org'        : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
142   ssl::service { 'video.debconf.org'             : ensure => 'present',  notify  => Exec['service apache2 reload'], key => true, }
143   ssl::service { 'wiki.debconf.org'              : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
144   include apache2::proxy_http
145   ssl::service { 'www.debconf.org'               : ensure => 'ifstatic', notify  => Exec['service apache2 reload'], key => true, }
146
147
148   if has_role('static_mirror_onion') {
149     if ! $onion_v4_addr {
150       fail("Do not have an onion_v4_addr set for $::hostname.")
151     }
152
153     onion::service { 'd-i.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
154     onion::service { 'dpl.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
155     onion::service { 'dsa.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
156     onion::service { 'rtc.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
157     onion::service { 'www.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
158
159     # do
160     onion::service { 'appstream.debian.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
161     onion::service { 'backports.debian.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
162     onion::service { 'bits.debian.org'               : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
163     onion::service { 'blends.debian.org'             : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
164     onion::service { 'cdbuilder-logs.debian.org'     : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
165     onion::service { 'incoming.debian.org'           : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
166     onion::service { 'incoming.ports.debian.org'     : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
167     onion::service { 'lintian.debian.org'            : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
168     onion::service { 'manpages.debian.org'           : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
169     onion::service { 'mirror-master.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
170     onion::service { 'onion.debian.org'              : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
171     onion::service { 'openpgpkey.debian.org'         : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
172     onion::service { 'release.debian.org'            : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
173     onion::service { 'security-team.debian.org'      : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
174     onion::service { 'www.ports.debian.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
175     # dn
176     onion::service { 'bootstrap.debian.net'           : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
177     onion::service { 'debaday.debian.net'            : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
178     onion::service { 'debdeltas.debian.net'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
179     onion::service { 'micronews.debian.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
180     onion::service { 'mozilla.debian.net'            : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
181     onion::service { 'news.debian.net'               : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
182     onion::service { 'timeline.debian.net'           : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
183     onion::service { 'wnpp-by-tags.debian.net'       : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
184     # dc
185     onion::service { '10years.debconf.org'           : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
186     onion::service { 'debconf0.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
187     onion::service { 'debconf1.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
188     onion::service { 'debconf16.debconf.org'         : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
189     onion::service { 'debconf17.debconf.org'         : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
190     onion::service { 'debconf18.debconf.org'         : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
191     onion::service { 'debconf2.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
192     onion::service { 'debconf3.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
193     onion::service { 'debconf4.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
194     onion::service { 'debconf5.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
195     onion::service { 'debconf6.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
196     onion::service { 'debconf7.debconf.org'          : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
197     onion::service { 'es.debconf.org'                : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
198     onion::service { 'fr.debconf.org'                : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
199     onion::service { 'miniconf10.debconf.org'        : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
200
201     # non-SSL
202     onion::service { 'metadata.ftp-master.debian.org': ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
203     onion::service { 'planet.debian.org'             : ensure => 'ifstatic', port => 80, target_port => 80, target_address => $onion_v4_addr }
204   }
205
206   file { '/srv/static.debian.org/puppet':
207     ensure => directory,
208     mode   => '02755'
209   }
210   file { '/srv/static.debian.org/puppet/disabled-service':
211     ensure => directory,
212     mode   => '02755'
213   }
214   file { '/srv/static.debian.org/puppet/disabled-service/503.html':
215     source => 'puppet:///modules/roles/static-htdocs/disabled-service/503.html',
216   }
217
218   ssl::service { 'archive.debian.net': ensure => present, notify  => Exec['service apache2 reload'], key => true, }
219   file { '/srv/static.debian.org/puppet/archive.debian.net':
220     ensure => absent,
221   }
222   file { '/srv/static.debian.org/puppet/archive.debian.net/503.html':
223     ensure => absent,
224   }
225
226   ssl::service { 'cdimage.debian.org': ensure => present, notify => Exec['service apache2 reload'], key => true, }
227   file { '/srv/static.debian.org/puppet/cdimage.debian.org':
228     ensure => directory,
229   }
230   file { '/srv/static.debian.org/puppet/cdimage.debian.org/503.html':
231     source => 'puppet:///modules/roles/static-htdocs/cdimage-maintenance.html',
232   }
233 }