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