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