Make an apache site for syncproxies
[mirror/dsa-puppet.git] / modules / roles / manifests / syncproxy.pp
1 class roles::syncproxy {
2         $bind = $::hostname ? {
3                 'milanollo' => '5.153.231.9',
4                 'mirror-isc' => '149.20.20.21',
5                 'mirror-umn' => '128.101.240.216',
6                 'klecker' => '130.89.148.10',
7                 default => ''
8         }
9         $bind6 = $::hostname ? {
10                 'milanollo' => '2001:41c8:1000:21::21:9',
11                 'mirror-isc' => '2001:4f8:8:36::1deb:21',
12                 'mirror-umn' => '2607:ea00:101:3c0b::1deb:216',
13                 'klecker' => '2001:610:1908:b000::148:10',
14                 default => ''
15         }
16         $syncproxy_name = $::hostname ? {
17                 'milanollo' => 'syncproxy3.eu.debian.org',
18                 'mirror-isc' => 'syncproxy2.wna.debian.org',
19                 'mirror-umn' => 'syncproxy.cna.debian.org',
20                 'klecker' => 'syncproxy2.eu.debian.org',
21                 default => 'unknown'
22         }
23
24         rsync::site { 'syncproxy':
25                 content => template('roles/syncproxy/rsyncd.conf.erb'),
26                 bind    => $bind,
27                 bind6   => $bind6,
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                 apache2::site { '010-syncproxy.debian.org':
42                         site   => 'security.debian.org',
43                         content => template('roles/syncproxy/syncproxy.debian.org-apache.erb')
44                 }
45
46                 file { [ '/srv/www/syncproxy.debian.org', '/srv/www/syncproxy.debian.org/htdocs' ]:
47                         ensure  => directory,
48                         mode    => '0755',
49                 }
50                 file { '/srv/www/syncproxy.debian.org/htdocs/index.html':
51                         content => template('roles/syncproxy/syncproxy.debian.org-index.html.erb')
52                 }
53         }
54 }