Puppet Class: tendril::maintenance

Defined in:
modules/tendril/manifests/maintenance.pp

Overview

Parameters:

  • tendril_host (Any)
  • tendril_user (Any)
  • tendril_password (Any)
  • tendril_db (Any) (defaults to: 'tendril')
  • tendril_port (Any) (defaults to: 3306)
  • wd_user (Any) (defaults to: undef)
  • wd_password (Any) (defaults to: undef)
  • ensure (Any) (defaults to: present)


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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'modules/tendril/manifests/maintenance.pp', line 6

class tendril::maintenance (
    $tendril_host,
    $tendril_user,
    $tendril_password,
    $tendril_db = 'tendril',
    $tendril_port = 3306,
    $wd_user = undef,
    $wd_password = undef,
    $ensure = present,
){

    require_package('libdbi-perl', 'libdbd-mysql-perl')

    # We want to control if cron is running, not if the scripts are installed.
    Cron {
        ensure => $ensure
    }

    File {
        ensure => present
    }

    $watchdog_user = $wd_user ? {
        undef   => $tendril_user,
        default => $wd_user,
    }
    $watchdog_password = $wd_password ? {
        undef   => $tendril_password,
        default => $wd_password,
    }

    group { 'tendril':
        ensure => present,
        name   => 'tendril',
    }

    user { 'tendril':
        ensure  => present,
        gid     => 'tendril',
        shell   => '/bin/false',
        home    => '/tmp',
        system  => true,
        require => Group['tendril'],
    }

    file { '/usr/local/bin/tendril-cron-5m.pl':
        owner  => 'tendril',
        group  => 'tendril',
        mode   => '0750',
        source => 'puppet:///modules/tendril/tendril-cron-5m.pl',
    }

    file { '/var/log/tendril-cron-5m.log':
        owner => 'tendril',
        group => 'tendril',
        mode  => '0640',
    }

    file { '/var/log/tendril-cron-5m.err':
        owner => 'tendril',
        group => 'tendril',
        mode  => '0640',
    }

    file { '/usr/local/bin/tendril-queries.pl':
        owner  => 'tendril',
        group  => 'tendril',
        mode   => '0750',
        source => 'puppet:///modules/tendril/tendril-queries.pl',
    }

    file { '/var/log/tendril-queries.log':
        owner => 'tendril',
        group => 'tendril',
        mode  => '0640',
    }

    file { '/var/log/tendril-queries.err':
        owner => 'tendril',
        group => 'tendril',
        mode  => '0640',
    }

    file { '/etc/mysql/tendril.cnf':
        owner   => 'tendril',
        group   => 'tendril',
        mode    => '0640',
        content => template('tendril/tendril.cnf.erb'),
    }

    cron { 'tendril-cron-5m':
        user    => 'tendril',
        command => '/usr/local/bin/tendril-cron-5m.pl /etc/mysql/tendril.cnf > /var/log/tendril-cron-5m.log 2> /var/log/tendril-cron-5m.err',
        minute  => '*/5',
        require => [
            File['/usr/local/bin/tendril-cron-5m.pl'],
            File['/var/log/tendril-cron-5m.log'],
            File['/var/log/tendril-cron-5m.err'],
        ]
    }

    cron { 'tendril-queries':
        user    => 'tendril',
        command => '/usr/local/bin/tendril-queries.pl /etc/mysql/tendril.cnf > /var/log/tendril-queries.log 2> /var/log/tendril-queries.err',
        minute  => '*/5',
        require => [
            File['/usr/local/bin/tendril-queries.pl'],
            File['/var/log/tendril-queries.log'],
            File['/var/log/tendril-queries.err'],
            File['/etc/mysql/tendril.cnf'],
        ]
    }
}