Fix rsync setup on schmelzer
[mirror/dsa-puppet.git] / modules / roles / manifests / syncproxy.pp
1 class roles::syncproxy {
2         include roles::archvsync_base
3
4         $mirror_basedir_prefix = hiera('role_config__syncproxy.mirror_basedir_prefix')
5
6         $binds = $::hostname ? {
7                 'milanollo'    => [ '5.153.231.9', '[2001:41c8:1000:21::21:9]' ],
8                 'mirror-anu'   => [ '150.203.164.60', '[2001:388:1034:2900::3c]' ],
9                 'mirror-conova' => [ '217.196.149.237', '[2a02:16a8:dc41:100::237]' ],
10                 'mirror-isc'   => [ '149.20.4.16', '[2001:4f8:1:c::16]' ],
11                 'mirror-umn'   => [ '128.101.240.216', '[2607:ea00:101:3c0b::1deb:216]' ],
12                 'klecker'      => [ '130.89.148.10', '[2001:67c:2564:a119::148:10]' ],
13                 'gretchaninov' => [ '209.87.16.40', '[2607:f8f0:614:1::1274:40]' ],
14                 'schmelzer'    => [ '217.196.149.237', '[2a02:16a8:dc41:100::237]' ],
15                 default        => [ '[::]' ],
16         }
17         $syncproxy_name = $::hostname ? {
18                 'milanollo' => 'syncproxy3.eu.debian.org',
19                 'mirror-anu' => 'syncproxy.au.debian.org',
20                 'mirror-conova' => 'syncproxy4.eu.debian.org',
21                 'schmelzer' => 'syncproxy4.eu.debian.org',
22                 'mirror-isc' => 'syncproxy2.wna.debian.org',
23                 'mirror-umn' => 'syncproxy.cna.debian.org',
24                 'klecker' => 'syncproxy2.eu.debian.org',
25                 'gretchaninov' => 'syncproxy3.wna.debian.org',
26                 default => 'unknown'
27         }
28
29         file { '/etc/rsyncd':
30                 ensure => 'directory'
31         }
32
33         file { '/etc/rsyncd/debian.secrets':
34                 owner => 'root',
35                 group => 'mirroradm',
36                 mode => '0660',
37         }
38
39         if $::apache2 and $syncproxy_name != 'unknown' {
40                 include apache2::ssl
41                 ssl::service { "$syncproxy_name":
42                         notify  => Exec['service apache2 reload'],
43                         key => true,
44                 }
45                 apache2::site { '010-syncproxy.debian.org':
46                         site   => 'syncproxy.debian.org',
47                         content => template('roles/syncproxy/syncproxy.debian.org-apache.erb')
48                 }
49
50                 file { [ '/srv/www/syncproxy.debian.org', '/srv/www/syncproxy.debian.org/htdocs' ]:
51                         ensure  => directory,
52                         mode    => '0755',
53                 }
54                 file { '/srv/www/syncproxy.debian.org/htdocs/index.html':
55                         content => template('roles/syncproxy/syncproxy.debian.org-index.html.erb')
56                 }
57
58                 rsync::site { 'syncproxy':
59                         content => template('roles/syncproxy/rsyncd.conf.erb'),
60                         binds   => $binds,
61                         sslname => "$syncproxy_name",
62                 }
63         } else {
64                 rsync::site { 'syncproxy':
65                         content => template('roles/syncproxy/rsyncd.conf.erb'),
66                         binds   => $binds,
67                 }
68         }
69 }