/[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 3307 - (show annotations) (download)
Thu Jul 25 22:09:21 2013 UTC (10 years, 9 months ago) by boklm
File size: 2562 byte(s)
youri-check: add ssl vhost
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 require => User[$base::user],
40 }
41 }
42
43 define check($version, $hour = "*", $minute = 0) {
44 include youri-check::base
45 $config = "/etc/youri/$version.conf"
46 $pgsql_server = $base::pgsql_server
47 $pgsql_db = "youri_check_$version"
48 $pgsql_user = "youri$version"
49 $pgsql_password = extlookup('youri_pgsql','x')
50
51 postgresql::remote_user { $pgsql_user:
52 password => $base::pgsql_password,
53 }
54
55 postgresql::remote_database { $pgsql_db:
56 description => "Youri Check results",
57 user => $pgsql_user,
58 }
59 cron { "check_$version":
60 command => "youri-check -c $config test",
61 hour => $hour,
62 minute => $minute,
63 user => $base::user,
64 environment => "MAILTO=root",
65 require => User[$base::user],
66 }
67 }
68
69 define report_www {
70 include youri-check::base
71 $outdir = "/var/www/youri-check/"
72 apache::vhost::base { $base::vhost:
73 location => $outdir,
74 }
75 apache::vhost::base { "ssl_${base::vhost}":
76 vhost => $base::vhost,
77 use_ssl => true,
78 location => $outdir,
79 }
80 }
81
82 define report($version, $hour = "*", $minute = 20) {
83 include youri-check::base
84
85 $config = "/etc/youri/$version.conf"
86
87 $outdir = "/var/www/youri-check/$version"
88 file { "$outdir":
89 ensure => directory,
90 owner => $base::user,
91 mode => 755,
92 }
93
94 cron { "check_$version":
95 command => "youri-check -c $config report",
96 hour => $hour,
97 minute => $minute,
98 user => $base::user,
99 require => User[$base::user],
100 }
101 }
102 }

  ViewVC Help
Powered by ViewVC 1.1.30