diff --git a/manifests/director.pp b/manifests/director.pp index fa51564..5a86be5 100644 --- a/manifests/director.pp +++ b/manifests/director.pp @@ -235,10 +235,16 @@ require => $service_require, } + if $::osfamily == 'Debian' { + $bconsole = '/usr/bin/bconsole' + } else { + $bconsole = '/usr/sbin/bconsole' + } + # Instead of restarting the bacula-dir service which could interrupt running jobs tell the director to reload its # configuration. exec { 'bacula-dir reload': - command => '/bin/echo reload | /usr/sbin/bconsole', + command => "/bin/echo reload | ${bconsole}", logoutput => on_failure, refreshonly => true, timeout => 10, diff --git a/manifests/director/mysql.pp b/manifests/director/mysql.pp index 220e5a7..05dce44 100644 --- a/manifests/director/mysql.pp +++ b/manifests/director/mysql.pp @@ -47,7 +47,12 @@ $db_require = Class['::mysql::server'] } } else { - $db_require = undef + if defined(Class['percona']) { + $db_require = Class['percona'] + $is_percona = true + } else { + $db_require = undef + } } $db_user_host_real = $db_user_host ? { @@ -55,20 +60,36 @@ default => $db_user_host, } - mysql::db { $db_database: - user => $db_user, - password => $db_password, - host => $db_user_host, - grant => ['all'], - require => $db_require, - notify => Exec['make_db_tables'], + if $is_percona { + percona::database { $db_database: + ensure => present, + notify => Exec['make_db_tables'], + } + + percona::rights { "${db_user}@${db_user_host}/${db_database}": + database => $db_database, + priv => [ 'all' ], + host => $db_user_host, + password => $db_password, + } + } else { + mysql::db { $db_database: + user => $db_user, + password => $db_password, + host => $db_user_host, + grant => ['all'], + require => $db_require, + notify => Exec['make_db_tables'], + } } } $make_db_tables_command = $::operatingsystem ? { - /(Ubuntu|Debian)/ => '/usr/lib/bacula/make_bacula_tables', - default => '/usr/libexec/bacula/make_mysql_tables', + Debian => '/usr/lib/bacula/make_bacula_tables', + Ubuntu => '/usr/share/bacula-director/make_mysql_tables', + default => '/usr/libexec/bacula/make_mysql_tables', } + $db_parameters = "--host=${db_host} --user=${db_user} --password=${db_password} --port=${db_port} --database=${db_database}" exec { 'make_db_tables':