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 |
|
24 |
} |
25 |
|
26 |
class check inherits base { |
27 |
package { ['perl-Youri-Media', 'youri-check', 'perl-DBD-Pg'] : |
28 |
ensure => installed |
29 |
} |
30 |
|
31 |
cron { 'check': |
32 |
command => "youri-check -c $config test", |
33 |
hour => [0, 6, 12, 18] |
34 |
minute => 4 |
35 |
user => "$user", |
36 |
} |
37 |
|
38 |
file { "$config": |
39 |
ensure => present, |
40 |
owner => $user, |
41 |
mode => 640, |
42 |
content => template("youri-check/check.conf"), |
43 |
} |
44 |
} |
45 |
|
46 |
class report inherits base { |
47 |
file { "$outdir": |
48 |
ensure => directory, |
49 |
owner => apache, |
50 |
mode => 755 |
51 |
} |
52 |
|
53 |
package { ['youri-check', 'perl-DBD-Pg'] : |
54 |
ensure => installed |
55 |
} |
56 |
|
57 |
cron { 'check': |
58 |
command => "youri-check -c $config report", |
59 |
hour => [1, 7, 13, 19] |
60 |
user => "$user", |
61 |
} |
62 |
|
63 |
apache::vhost_simple { $vhost: |
64 |
location => $outdir, |
65 |
} |
66 |
} |
67 |
} |