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