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