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