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 |
ensure => present, |
13 |
comment => "Maintainers database", |
14 |
managehome => true, |
15 |
shell => "/bin/bash", |
16 |
home => "$homedir", |
17 |
} |
18 |
|
19 |
file { ["$homedir","$dbdir"]: |
20 |
ensure => directory, |
21 |
owner => "$login", |
22 |
group => "$login", |
23 |
mode => 711, |
24 |
require => User["$login"], |
25 |
} |
26 |
|
27 |
file { "$binpath": |
28 |
mode => 755, |
29 |
content => template("buildsystem/maintdb/maintdb.bin") |
30 |
} |
31 |
|
32 |
local_script { "wrapper.maintdb": |
33 |
content => template("buildsystem/maintdb/wrapper.maintdb") |
34 |
} |
35 |
|
36 |
sudo::sudoers_config { "maintdb": |
37 |
content => template("buildsystem/maintdb/sudoers.maintdb") |
38 |
} |
39 |
|
40 |
file { ["$dump","$dump.new", |
41 |
"$unmaintained","$unmaintained.new"]: |
42 |
ensure => present, |
43 |
owner => $login, |
44 |
mode => 644, |
45 |
require => File["/var/www/bs/data"], |
46 |
} |
47 |
|
48 |
cron { "update maintdb export": |
49 |
user => $login, |
50 |
command => "$binpath root get > $dump.new; cp -f $dump.new $dump; grep ' nobody\$' $dump | sed 's/ nobody\$//' > $unmaintained.new; cp -f $unmaintained.new $unmaintained", |
51 |
minute => "*/30", |
52 |
require => User[$login], |
53 |
} |
54 |
|
55 |
apache::vhost_base { "maintdb.$domain": |
56 |
location => $dbdir, |
57 |
content => template("buildsystem/maintdb/vhost_maintdb.conf"), |
58 |
} |
59 |
} |
60 |
} |
61 |
|