fix whitespace
[mirror/dsa-puppet.git] / modules / roles / manifests / syncproxy.pp
1 class roles::syncproxy {
2         $bind = $::hostname ? {
3                 'milanollo' => '5.153.231.9',
4                 'mirror-anu' => '150.203.164.60',
5                 'mirror-isc' => '149.20.20.21',
6                 'mirror-umn' => '128.101.240.216',
7                 'klecker' => '130.89.148.10',
8                 default => ''
9         }
10         $bind6 = $::hostname ? {
11                 'milanollo' => '2001:41c8:1000:21::21:9',
12                 'mirror-anu' => '2001:388:1034:2900::3c',
13                 'mirror-isc' => '2001:4f8:8:36::1deb:21',
14                 'mirror-umn' => '2607:ea00:101:3c0b::1deb:216',
15                 'klecker' => '2001:610:1908:b000::148:10',
16                 default => ''
17         }
18         $syncproxy_name = $::hostname ? {
19                 'milanollo' => 'syncproxy3.eu.debian.org',
20                 'mirror-anu' => 'syncproxy.au.debian.org',
21                 'mirror-isc' => 'syncproxy2.wna.debian.org',
22                 'mirror-umn' => 'syncproxy.cna.debian.org',
23                 'klecker' => 'syncproxy2.eu.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 => Service['apache2'],
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                         bind    => $bind,
59                         bind6   => $bind6,
60                         sslname => "$syncproxy_name",
61                 }
62         } else {
63                 rsync::site { 'syncproxy':
64                         content => template('roles/syncproxy/rsyncd.conf.erb'),
65                         bind    => $bind,
66                         bind6   => $bind6,
67                 }
68         }
69 }