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 |
ensure => installed |
39 |
} |
40 |
|
41 |
cron { 'check': |
42 |
command => "youri-check -c $config test", |
43 |
hour => "*", |
44 |
minute => 4, |
45 |
user => "$user", |
46 |
environment => "MAILTO=root", |
47 |
} |
48 |
} |
49 |
|
50 |
class report inherits base { |
51 |
file { "$outdir": |
52 |
ensure => directory, |
53 |
owner => youri, |
54 |
mode => 755 |
55 |
} |
56 |
|
57 |
postgresql::remote_user { $pgsql_user: |
58 |
password => $pgsql_password, |
59 |
} |
60 |
|
61 |
postgresql::remote_database { $pgsql_db: |
62 |
description => "Youri Check results", |
63 |
user => $pgsql_user, |
64 |
} |
65 |
|
66 |
package { ['youri-check', 'perl-DBD-Pg'] : |
67 |
ensure => installed |
68 |
} |
69 |
|
70 |
cron { 'check': |
71 |
command => "youri-check -c $config report", |
72 |
hour => "*", |
73 |
minute => 24, |
74 |
user => "$user", |
75 |
} |
76 |
|
77 |
apache::vhost_simple { $vhost: |
78 |
location => $outdir, |
79 |
} |
80 |
} |
81 |
} |