summaryrefslogtreecommitdiff
path: root/manifests/init.pp
blob: d21176a1214176b818d06863409aeb5e67662c87 (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
# mysql.pp
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# changed by immerda project group (admin(at)immerda.ch)

class mysql::server {
    case $operatingsystem {
        gentoo: { include mysql::server::gentoo }
        default: { include mysql::server::base }
    }

    if $selinux {
        include mysql::selinux
    }
}

class mysql::server::base {
    package { mysql:
        ensure => present,
    }

    file{
        "/etc/mysql/my.cnf":
            source => [
                "puppet://$server/files/mysql/${fqdn}/my.cnf",
                "puppet://$server/files/mysql/my.cnf",
                "puppet://$server/mysql/my.cnf"
            ],
            ensure => file,
            owner => root,
            group => 0,
            mode => 0444,
            require => Package[mysql],
            notify => Service[mysql],
    }

	service { mysql:
		ensure => running,
		hasstatus => true,
		require => Package[mysql],
	}

	munin::plugin {
		[mysql_bytes, mysql_queries, mysql_slowqueries, mysql_threads]:
	}

	# Collect all databases and users
	Mysql_database<<||>>
	Mysql_user<<||>>
	Mysql_grant<<||>>
}

class mysql::server::gentoo inherits mysql::server::base {
    Package[mysql] {
        category => 'dev-db',
    }
}