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/tmp/youri' |
8 |
|
9 |
user { $user: |
10 |
comment => 'Youri Check', |
11 |
ensure => present, |
12 |
managehome => true, |
13 |
home => $home, |
14 |
} |
15 |
|
16 |
$pgsql_server = "$vhost" |
17 |
$pgsql_db = 'youri_check' |
18 |
$pgsql_user = 'youri' |
19 |
$pgsql_password = extlookup('youri_pgsql','x') |
20 |
postgresql::remote_user { $pgsql_user: |
21 |
password => $pgsql_password, |
22 |
} |
23 |
postgresql::remote_database { $pgsql_db: |
24 |
description => "Youri Check results", |
25 |
user => $pgsql_user, |
26 |
} |
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 |
} |
47 |
} |
48 |
|
49 |
class report inherits base { |
50 |
file { "$outdir": |
51 |
ensure => directory, |
52 |
owner => youri, |
53 |
mode => 755 |
54 |
} |
55 |
|
56 |
package { ['youri-check', 'perl-DBD-Pg'] : |
57 |
ensure => installed |
58 |
} |
59 |
|
60 |
cron { 'check': |
61 |
command => "youri-check -c $config report", |
62 |
hour => "*", |
63 |
minute => 10, |
64 |
user => "$user", |
65 |
} |
66 |
|
67 |
apache::vhost_simple { $vhost: |
68 |
location => $outdir, |
69 |
} |
70 |
} |
71 |
} |