1 |
class buildsystem { |
2 |
class maintdb { |
3 |
include sudo |
4 |
$login = "maintdb" |
5 |
$homedir = "/var/lib/maintdb" |
6 |
$dbdir = "$homedir/db" |
7 |
$binpath = "/usr/local/sbin/maintdb" |
8 |
$dump = "/var/www/bs/data/maintdb.txt" |
9 |
$unmaintained = "/var/www/bs/data/unmaintained.txt" |
10 |
|
11 |
user {"$login": |
12 |
comment => "Maintainers database", |
13 |
home => "$homedir", |
14 |
} |
15 |
|
16 |
file { ["$homedir","$dbdir"]: |
17 |
ensure => directory, |
18 |
owner => "$login", |
19 |
group => "$login", |
20 |
mode => 711, |
21 |
require => User["$login"], |
22 |
} |
23 |
|
24 |
file { "$binpath": |
25 |
mode => 755, |
26 |
content => template("buildsystem/maintdb/maintdb.bin") |
27 |
} |
28 |
|
29 |
local_script { "wrapper.maintdb": |
30 |
content => template("buildsystem/maintdb/wrapper.maintdb") |
31 |
} |
32 |
|
33 |
sudo::sudoers_config { "maintdb": |
34 |
content => template("buildsystem/maintdb/sudoers.maintdb") |
35 |
} |
36 |
|
37 |
file { ["$dump","$dump.new", |
38 |
"$unmaintained","$unmaintained.new"]: |
39 |
owner => $login, |
40 |
require => File["/var/www/bs/data"], |
41 |
} |
42 |
|
43 |
cron { "update maintdb export": |
44 |
user => $login, |
45 |
command => "$binpath root get > $dump.new; cp -f $dump.new $dump; grep ' nobody\$' $dump | sed 's/ nobody\$//' > $unmaintained.new; cp -f $unmaintained.new $unmaintained", |
46 |
minute => "*/30", |
47 |
require => User[$login], |
48 |
} |
49 |
|
50 |
apache::vhost_base { "maintdb.$domain": |
51 |
location => $dbdir, |
52 |
content => template("buildsystem/maintdb/vhost_maintdb.conf"), |
53 |
} |
54 |
} |
55 |
} |
56 |
|