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