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