define database::config( $value, $section = '', $ensure = 'present' ) { # Guess section based on operating system and implementation $implementation = $::mysql::server::implementation $real_section = $section ? { '' => $implementation ? { 'mysql-server' => $::lsbdistid ? { 'Ubuntu' => 'mysql.conf.d', 'Debian' => 'mariadb.conf.d', }, 'mariadb-server' => 'mariadb.conf.d', }, default => $section, } file { "/etc/mysql/${real_section}/${name}.cnf": ensure => $ensure, owner => root, group => root, mode => '0644', content => "[mysqld]\n${name} = ${value}\n", notify => Service['mysql'], } }