summaryrefslogtreecommitdiff
path: root/manifests/server.pp
blob: 5a34b1c8ff58fc2dde0cd89d6a9235f46e4be81b (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
# manage a mysql server
class mysql::server (
  $root_password,
  $manage_shorewall     = false,
  $manage_munin         = false,
  $munin_password       = 'absent',
  $manage_nagios        = false,
  $nagios_password_hash = 'absent',
  $backup_cron          = false,
  $optimize_cron        = false,
  $optimize_hour        = fqdn_rand(7),
  $optimize_minute      = fqdn_rand(60),
  $optimize_day         = fqdn_rand(7),
  $backup_dir           = '/var/backups/mysql',
  $manage_backup_dir    = true,
  $nagios_notcp         = false
) {
  case $::operatingsystem {
    gentoo:  { include mysql::server::gentoo }
    centos:  { include mysql::server::centos }
    debian:  { include mysql::server::debian }
    default: { include mysql::server::base }
  }

  if $manage_munin and $::mysql_exists == 'true' {
    if $munin_password == 'absent' and $::operatingsystem != debian {
      fail('need to set the munin password')
    }
    case $::operatingsystem {
      debian:  { include mysql::server::munin::debian }
      default: { include mysql::server::munin::default }
    }
  }

  if $manage_nagios and $::mysql_exists == 'true' {
    if $nagios_password_hash == 'absent' {
      fail('need to set the nagios password hash')
    }
    include mysql::server::nagios
  }

  if $manage_shorewall {
    include shorewall::rules::mysql
  }
}