aboutsummaryrefslogtreecommitdiffstats
path: root/modules/youri-check/manifests/init.pp
blob: 0d73a2b4a0ec5d5376e9e18dae73257a5c5f6121 (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
68
69
70
71
72
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,
        }
        postgresql::remote_database { $pgsql_db:
            description => "Youri Check results",
            user => $pgsql_user,
        }

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

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

        cron { 'check':
            command => "youri-check -c $config test",
            hour => "*",
            minute => 4,
            user => "$user",
	    environment => "MAILTO=root@$domain",
        }
    }

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

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

        cron { 'check':
            command => "youri-check -c $config report",
            hour => "*",
            minute => 10,
            user => "$user",
        }

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