0bed3486077a64a59963c237b403e4d5e4bdfffc
[mirror/dsa-puppet.git] / modules / roles / manifests / static_mirror.pp
1 class roles::static_mirror {
2
3         include roles::static_source
4         include apache2::cache
5
6         package { 'libapache2-mod-geoip': ensure => installed, }
7         package { 'geoip-database': ensure => installed, }
8
9         include apache2::ssl
10         apache2::module { 'include': }
11         apache2::module { 'geoip': require => [Package['libapache2-mod-geoip'], Package['geoip-database']]; }
12
13         file { '/usr/local/bin/static-mirror-run':
14                 source => 'puppet:///modules/roles/static-mirroring/static-mirror-run',
15                 mode   => '0555',
16         }
17
18         file { '/usr/local/bin/static-mirror-run-all':
19                 source => 'puppet:///modules/roles/static-mirroring/static-mirror-run-all',
20                 mode   => '0555',
21         }
22
23         file { '/srv/static.debian.org':
24                 ensure => directory,
25                 owner  => staticsync,
26                 group  => staticsync,
27                 mode   => '02755'
28         }
29
30         file { '/etc/cron.d/puppet-static-mirror':
31                         content => "MAILTO=root\nPATH=/usr/local/bin:/usr/bin:/bin\n@reboot staticsync sleep 60; chronic static-mirror-run-all\n",
32         }
33
34         $onion_v4_addr = $::hostname ? {
35                 busoni     => '140.211.15.34',
36                 klecker    => '130.89.148.14',
37                 mirror-isc => '149.20.20.22',
38                 senfter    => '5.153.231.4',
39                 default    => undef,
40         }
41         $vhost_listen = $::hostname ? {
42                 klecker    => '130.89.148.14:80 [2001:610:1908:b000::148:14]:80',
43                 mirror-isc => '149.20.20.22:80 [2001:4f8:8:36::1deb:22]:80',
44                 mirror-anu => '150.203.164.62:80 [2001:388:1034:2900::3e]:80',
45                 default    => '*:80',
46         }
47         $vhost_listen_443 = $::hostname ? {
48                 klecker    => '130.89.148.14:443 [2001:610:1908:b000::148:14]:443',
49                 mirror-isc => '149.20.20.22:443 [2001:4f8:8:36::1deb:22]:443',
50                 mirror-anu => '150.203.164.62:443 [2001:388:1034:2900::3e]:443',
51                 default    => '*:443',
52         }
53
54         apache2::config { 'local-static-vhost.conf':
55                 content => template('roles/static-mirroring/static-vhost.conf.erb'),
56         }
57
58         apache2::site { '010-planet.debian.org':
59                 site    => 'planet.debian.org',
60                 ensure  => has_static_component('planet.debian.org') ? { true => "present", false => "absent" },
61                 content => template('roles/static-mirroring/vhost/planet.debian.org.erb'),
62         }
63
64         apache2::site { '010-lintian.debian.org':
65                 site    => 'lintian.debian.org',
66                 ensure  => absent,
67         }
68
69         apache2::site { '010-static-vhosts-simple':
70                 site => 'static-vhosts-simple',
71                 content => template('roles/static-mirroring/vhost/static-vhosts-simple.erb'),
72         }
73
74         $wwwdo_document_root = '/srv/static.debian.org/mirrors/www.debian.org/cur'
75         apache2::site { '005-www.debian.org':
76                 site   => 'www.debian.org',
77                 ensure  => has_static_component('www.debian.org') ? { true => "present", false => "absent" },
78                 content => template('roles/apache-www.debian.org.erb'),
79         }
80
81         ssl::service { 'dsa.debian.org'      : ensure => "ifstatic", notify  => Exec['service apache2 reload'], }
82         ssl::service { 'www.debian.org'      : ensure => "ifstatic", notify  => Exec['service apache2 reload'], }
83         ssl::service { 'rtc.debian.org'      : ensure => "ifstatic", notify  => Exec['service apache2 reload'], }
84         ssl::service { 'd-i.debian.org'      : ensure => "ifstatic", notify  => Exec['service apache2 reload'], }
85
86         # do
87         ssl::service { 'appstream.debian.org'          : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
88         ssl::service { 'backports.debian.org'          : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
89         ssl::service { 'bits.debian.org'               : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
90         ssl::service { 'blends.debian.org'             : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
91         ssl::service { 'incoming.debian.org'           : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
92         ssl::service { 'incoming.ports.debian.org'     : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
93         ssl::service { 'lintian.debian.org'            : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
94         ssl::service { 'onion.debian.org'              : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
95         ssl::service { 'release.debian.org'            : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
96         ssl::service { 'security-team.debian.org'      : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
97         ssl::service { 'www.ports.debian.org'          : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
98         # dn
99         ssl::service { 'bootstrap.debian.net'          : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
100         ssl::service { 'debaday.debian.net'            : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
101         ssl::service { 'debdeltas.debian.net'          : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
102         ssl::service { 'micronews.debian.net'          : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
103         ssl::service { 'mozilla.debian.net'            : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
104         ssl::service { 'news.debian.net'               : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
105         ssl::service { 'timeline.debian.net'           : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
106         ssl::service { 'wnpp-by-tags.debian.net'       : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
107         # dc
108         ssl::service { '10years.debconf.org'           : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
109         ssl::service { 'debconf0.debconf.org'          : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
110         ssl::service { 'debconf1.debconf.org'          : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
111         ssl::service { 'debconf16.debconf.org'         : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
112         ssl::service { 'debconf2.debconf.org'          : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
113         ssl::service { 'debconf3.debconf.org'          : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
114         ssl::service { 'debconf4.debconf.org'          : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
115         ssl::service { 'debconf5.debconf.org'          : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
116         ssl::service { 'debconf6.debconf.org'          : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
117         ssl::service { 'debconf7.debconf.org'          : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
118         ssl::service { 'es.debconf.org'                : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
119         ssl::service { 'fr.debconf.org'                : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
120         ssl::service { 'miniconf10.debconf.org'        : ensure => "ifstatic", notify  => Exec['service apache2 reload'], key => true, }
121
122         if has_role('static_mirror_onion') {
123                 if ! $onion_v4_addr {
124                         fail("Do not have an onion_v4_addr set for $::hostname.")
125                 }
126
127                 onion::service { 'd-i.debian.org'      : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
128                 onion::service { 'dsa.debian.org'      : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
129                 onion::service { 'rtc.debian.org'      : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
130                 onion::service { 'www.debian.org'      : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
131
132                 # do
133                 onion::service { 'appstream.debian.org'          : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
134                 onion::service { 'backports.debian.org'          : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
135                 onion::service { 'bits.debian.org'               : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
136                 onion::service { 'blends.debian.org'             : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
137                 onion::service { 'incoming.debian.org'           : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
138                 onion::service { 'incoming.ports.debian.org'     : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
139                 onion::service { 'lintian.debian.org'            : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
140                 onion::service { 'onion.debian.org'              : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
141                 onion::service { 'release.debian.org'            : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
142                 onion::service { 'security-team.debian.org'      : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
143                 onion::service { 'www.ports.debian.org'          : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
144                 # dn
145                 onion::service { 'bootstrap.debian.net'           : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
146                 onion::service { 'debaday.debian.net'            : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
147                 onion::service { 'debdeltas.debian.net'          : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
148                 onion::service { 'micronews.debian.net'          : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
149                 onion::service { 'mozilla.debian.net'            : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
150                 onion::service { 'news.debian.net'               : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
151                 onion::service { 'timeline.debian.net'           : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
152                 onion::service { 'wnpp-by-tags.debian.net'       : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
153                 # dc
154                 onion::service { '10years.debconf.org'           : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
155                 onion::service { 'debconf0.debconf.org'          : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
156                 onion::service { 'debconf1.debconf.org'          : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
157                 onion::service { 'debconf16.debconf.org'         : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
158                 onion::service { 'debconf2.debconf.org'          : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
159                 onion::service { 'debconf3.debconf.org'          : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
160                 onion::service { 'debconf4.debconf.org'          : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
161                 onion::service { 'debconf5.debconf.org'          : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
162                 onion::service { 'debconf6.debconf.org'          : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
163                 onion::service { 'debconf7.debconf.org'          : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
164                 onion::service { 'es.debconf.org'                : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
165                 onion::service { 'fr.debconf.org'                : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
166                 onion::service { 'miniconf10.debconf.org'        : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
167
168                 # non-SSL
169                 onion::service { 'metadata.ftp-master.debian.org': ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
170                 onion::service { 'planet.debian.org'             : ensure => "ifstatic", port => 80, target_port => 80, target_address => $onion_v4_addr }
171         }
172 }