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