1 |
class youri-check { |
2 |
class base { |
3 |
$vhost = "check.$domain" |
4 |
$user = 'youri' |
5 |
$config = '/etc/youri/cauldron.conf' |
6 |
$outdir = '/var/www/youri-check' |
7 |
$home = '/var/lib/youri' |
8 |
|
9 |
user { $user: |
10 |
comment => 'Youri Check', |
11 |
home => $home, |
12 |
} |
13 |
|
14 |
file { $home: |
15 |
ensure => directory, |
16 |
owner => $user, |
17 |
group => $user, |
18 |
mode => 755, |
19 |
} |
20 |
|
21 |
$pgsql_server = "$vhost" |
22 |
$pgsql_db = 'youri_check' |
23 |
$pgsql_user = 'youri' |
24 |
$pgsql_password = extlookup('youri_pgsql','x') |
25 |
|
26 |
file { "$config": |
27 |
ensure => present, |
28 |
owner => $user, |
29 |
mode => 640, |
30 |
content => template("youri-check/check.conf"), |
31 |
} |
32 |
} |
33 |
|
34 |
class check inherits base { |
35 |
package { ['perl-Youri-Media', 'youri-check', 'perl-DBD-Pg']: } |
36 |
|
37 |
cron { 'check': |
38 |
command => "youri-check -c $config test", |
39 |
hour => "*", |
40 |
minute => 4, |
41 |
user => "$user", |
42 |
environment => "MAILTO=root", |
43 |
} |
44 |
} |
45 |
|
46 |
class report inherits base { |
47 |
file { "$outdir": |
48 |
ensure => directory, |
49 |
owner => $user, |
50 |
} |
51 |
|
52 |
postgresql::remote_user { $pgsql_user: |
53 |
password => $pgsql_password, |
54 |
} |
55 |
|
56 |
postgresql::remote_database { $pgsql_db: |
57 |
description => "Youri Check results", |
58 |
user => $pgsql_user, |
59 |
} |
60 |
|
61 |
package { ['youri-check', 'perl-DBD-Pg']: } |
62 |
|
63 |
cron { 'check': |
64 |
command => "youri-check -c $config report", |
65 |
hour => "*", |
66 |
minute => 24, |
67 |
user => "$user", |
68 |
} |
69 |
|
70 |
apache::vhost_simple { $vhost: |
71 |
location => $outdir, |
72 |
} |
73 |
} |
74 |
} |