aboutsummaryrefslogtreecommitdiffstats
path: root/modules/youri-check/manifests/init.pp
blob: 9214fe857094c9c3f4a605ce24d3e425ae115cc9 (plain)
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
class youri-check {
    class base {
        $vhost = "check.$domain"
        $user = 'youri'
        $config = '/etc/youri/cauldron.conf'
        $outdir = '/var/www/youri-check'
        $home = '/var/tmp/youri'

        user { $user:
            comment => 'Youri Check',
            ensure => present,
            managehome => true,
            home => $home,
        }

        $pgsql_server = "$vhost"
        $pgsql_db = 'youri_check'
        $pgsql_user = 'youri'
        $pgsql_password = extlookup('youri_pgsql','x')
        postgresql::remote_user { $pgsql_user:
            password => $pgsql_password,
        }

    }

    class check inherits base {
        package { ['perl-Youri-Media', 'youri-check', 'perl-DBD-Pg'] :
            ensure => installed
        }

        cron { 'check':
            command => "youri-check -c $config test",
            hour => [0, 6, 12, 18],
            minute => 4,
            user => "$user",
        }

        file { "$config":
            ensure => present,
            owner => $user,
            mode => 640,
            content => template("youri-check/check.conf"),
        }
    }

    class report inherits base {
        file { "$outdir":
            ensure => directory,
            owner => apache,
            mode => 755
        }

        package { ['youri-check', 'perl-DBD-Pg'] :
            ensure => installed
        }

        cron { 'check':
            command => "youri-check -c $config report",
            hour => [1, 7, 13, 19],
            user => "$user",
        }

        apache::vhost_simple { $vhost:
            location => $outdir,
        }
    }
}