1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
class youri-check {
class base {
$vhost = "check.${::domain}"
$user = 'youri'
$home = '/var/lib/youri'
user { $user:
comment => 'Youri Check',
home => $home,
}
file { $home:
ensure => directory,
owner => $user,
group => $user,
}
$pgsql_server = "${vhost}"
package { ['youri-check', 'perl-DBD-Pg', 'perl-Youri-Media']: }
}
define config($version) {
include youri-check::base
$config = "/etc/youri/${version}.conf"
$outdir = "/var/www/youri-check/${version}"
$pgsql_db = "youri_check_${version}"
$pgsql_server = $base::pgsql_server
$pgsql_user = "youri${version}"
$pgsql_password = extlookup('youri_pgsql','x')
file { "${config}":
ensure => present,
owner => $base::user,
mode => '0640',
content => template("youri-check/${version}.conf"),
require => User[$base::user],
}
}
define check($version, $hour = "*", $minute = 0) {
include youri-check::base
$config = "/etc/youri/${version}.conf"
$pgsql_server = $base::pgsql_server
$pgsql_db = "youri_check_${version}"
$pgsql_user = "youri${version}"
$pgsql_password = extlookup('youri_pgsql','x')
postgresql::remote_user { $pgsql_user:
password => $base::pgsql_password,
}
postgresql::remote_database { $pgsql_db:
description => "Youri Check results",
user => $pgsql_user,
}
cron { "check_${version}":
command => "youri-check -c ${config} test",
hour => $hour,
minute => $minute,
user => $base::user,
environment => "MAILTO=root",
require => User[$base::user],
}
}
define report_www {
include youri-check::base
$outdir = "/var/www/youri-check/"
apache::vhost::base { $base::vhost:
location => $outdir,
content => template('youri-check/vhost_check.conf'),
}
apache::vhost::base { "ssl_${base::vhost}":
vhost => $base::vhost,
use_ssl => true,
location => $outdir,
content => template('youri-check/vhost_check.conf'),
}
}
define report($version, $hour = "*", $minute = 20) {
include youri-check::base
$config = "/etc/youri/${version}.conf"
$outdir = "/var/www/youri-check/${version}"
file { "${outdir}":
ensure => directory,
owner => $base::user,
mode => '0755',
}
cron { "check_${version}":
command => "youri-check -c ${config} report",
hour => $hour,
minute => $minute,
user => $base::user,
require => User[$base::user],
}
}
}
|