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

class mysql::server {

    $modulename = "mysql"
    $pkgname = "mysql"
    $gentoocat = "dev-db"
    $cnfname = "my.cnf"
    $cnfpath = "/etc/mysql"

    package { $pkgname:
        ensure => present,
        category => $operatingsystem ? {
            gentoo => $gentoocat,
            default => '',
        }
    }

    file{
        "${cnfpath}/${cnfname}":
            source => [
                "puppet://$server/dist/${modulename}/${fqdn}/${cnfname}",
                "puppet://$server/${modulename}/${fqdn}/${cnfname}",
                "puppet://$server/${modulename}/${cnfname}"
            ],
            ensure => file,
            owner => root,
            group => 0,
            mode => 0444,
            require => Package[$pkgname],
    }

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

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

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

}