summaryrefslogtreecommitdiff
path: root/manifests/config.pp
blob: 2bda473bdc7a2f242629f4a8a689b9b3ae0fbe0d (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
define database::config(
  $value,
  $section = '',
  $ensure  = 'present'
) {
  # Guess section based on operating system and implementation
  $implementation = $::mysql::server::implementation
  $section        = $implementation {
    'mysql-server'   => $::lsbdistid ? {
       'Ubuntu' => 'mysql.conf.d',
       'Debian' => 'mariadb.conf.d',
     },
    'mariadb-server' => 'mariadb.conf.d',
  }

  file { "/etc/mysql/${section}/${name}.cnf":
    ensure  => $ensure,
    owner   => root,
    group   => root,
    mode    => '0644',
    content => "[mysqld]\n${name} = ${value}\n",
    notify  => Service['mysql'],
  }
}