masters also talk to themselves
[mirror/dsa-puppet.git] / modules / roles / manifests / static_master.pp
1 # static master
2 #
3 # each component defines exactly one static master.  Content is copied from the source host
4 # to the master, and from there to all the mirrors.
5 #
6 class roles::static_master {
7   include roles::static::base
8   include roles::static::srvdir
9
10   # masters need to talk to mirrors and sources and themselves
11   class { 'roles::static::ssh':
12     add_tag     => [ 'staticsync-mirror', 'staticsync-source', 'staticsync-master' ],
13     collect_tag => 'staticsync-master',
14   }
15
16   file { '/usr/local/bin/static-master-run':
17     source => 'puppet:///modules/roles/static-mirroring/static-master-run',
18     mode   => '0555',
19   }
20   file { '/usr/local/bin/static-master-update-component':
21     source => 'puppet:///modules/roles/static-mirroring/static-master-update-component',
22     mode   => '0555',
23   }
24   file { '/etc/static-clients.conf':
25     content => template('roles/static-mirroring/static-clients.conf.erb'),
26   }
27
28   file { '/home/staticsync/static-master':
29     ensure => link,
30     target => '/srv/static.debian.org',
31   }
32   file { '/srv/static.debian.org/master':
33     ensure => directory,
34     mode   => '0755',
35     owner  => 'staticsync',
36     group  => 'staticsync',
37   }
38
39   # export some information for the onion.debian.org build
40   if $::hostname in [dillon] {
41     file { '/srv/puppet.debian.org':
42       ensure => directory
43     }
44     file { '/srv/puppet.debian.org/puppet-facts':
45       ensure => directory
46     }
47     concat { '/srv/puppet.debian.org/puppet-facts/onionbalance-services.yaml':
48       notify  => Exec['rebuild-onion-website'],
49     }
50     Concat::Fragment <<| tag == 'onionbalance-services.yaml' |>>
51
52     exec { 'rebuild-onion-website':
53       command => '/bin/su - staticsync -c \'make -C /srv/onion-master.debian.org\'',
54       refreshonly => true,
55     }
56   }
57 }