/[adm]/puppet/modules/youri-check/manifests/init.pp
ViewVC logotype

Contents of /puppet/modules/youri-check/manifests/init.pp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2421 - (show annotations) (download)
Fri Feb 17 09:21:52 2012 UTC (12 years, 1 month ago) by pterjan
File size: 2297 byte(s)
Include youri-check::base before using it
1 class youri-check {
2 class base {
3 $vhost = "check.$domain"
4 $user = 'youri'
5 $home = '/var/lib/youri'
6
7 user { $user:
8 comment => 'Youri Check',
9 home => $home,
10 }
11
12 file { $home:
13 ensure => directory,
14 owner => $user,
15 group => $user,
16 }
17
18 $pgsql_server = "$vhost"
19
20 package { ['youri-check', 'perl-DBD-Pg', 'perl-Youri-Media']: }
21
22 }
23
24 define config($version) {
25 include youri-check::base
26
27 $config = "/etc/youri/$version.conf"
28 $outdir = "/var/www/youri-check/$version"
29 $pgsql_db = "youri_check_$version"
30 $pgsql_server = $base::pgsql_server
31 $pgsql_user = "youri$version"
32 $pgsql_password = extlookup('youri_pgsql','x')
33
34 file { "$config":
35 ensure => present,
36 owner => $base::user,
37 mode => 640,
38 content => template("youri-check/$version.conf"),
39 }
40 }
41
42 define check($version, $hour = "*", $minute = 0) {
43 include youri-check::base
44 $config = "/etc/youri/$version.conf"
45 $pgsql_server = $base::pgsql_server
46 $pgsql_db = "youri_check_$version"
47 $pgsql_user = "youri$version"
48 $pgsql_password = extlookup('youri_pgsql','x')
49
50 postgresql::remote_user { $pgsql_user:
51 password => $base::pgsql_password,
52 }
53
54 postgresql::remote_database { $pgsql_db:
55 description => "Youri Check results",
56 user => $pgsql_user,
57 }
58 cron { "check_$version":
59 command => "youri-check -c $config test",
60 hour => $hour,
61 minute => $minute,
62 user => $base::user,
63 environment => "MAILTO=root",
64 }
65 }
66
67 define report_www {
68 include youri-check::base
69 $outdir = "/var/www/youri-check/"
70 apache::vhost_simple { $base::vhost:
71 location => $outdir,
72 }
73 }
74
75 define report($version, $hour = "*", $minute = 20) {
76 include youri-check::base
77
78 $config = "/etc/youri/$version.conf"
79
80 $outdir = "/var/www/youri-check/$version"
81 file { "$outdir":
82 ensure => directory,
83 owner => $base::user,
84 mode => 755,
85 }
86
87 cron { "check_$version":
88 command => "youri-check -c $config report",
89 hour => $hour,
90 minute => $minute,
91 user => $base::user,
92 }
93 }
94 }

  ViewVC Help
Powered by ViewVC 1.1.30