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