Skip to content

Instantly share code, notes, and snippets.

@bcicen
Last active August 29, 2015 14:00
Show Gist options
  • Save bcicen/11097507 to your computer and use it in GitHub Desktop.
Save bcicen/11097507 to your computer and use it in GitHub Desktop.
class mysqld::release::initialize{
file { "/var/lib/mysql_multi":
ensure => "directory",
owner => mysql,
group => mysql,
mode => 755,
}
define initdatadirs {
file { "${title}":
ensure => "directory",
owner => mysql,
group => mysql,
mode => 755,
require => File["/var/lib/mysql_multi"],
}
file { "${title}-logs":
ensure => "directory",
owner => mysql,
group => mysql,
mode => 755,
require => File["/var/lib/mysql_multi"],
}
exec { "mysql_install_db_${title}":
command => "mysql_install_db --user=mysql --datadir=${title}",
path => "/usr/local/bin/:/usr/bin/:/bin/",
require => [File["${title}"], File ["${title}-logs"]],
creates => "${title}/mysql/host.frm"
}
}
$release_mysql_datadirs = [
"/var/lib/mysql_multi/mysql-db1a",
"/var/lib/mysql_multi/mysql-db1b",
"/var/lib/mysql_multi/mysql-db2a",
"/var/lib/mysql_multi/mysql-db2b",
"/var/lib/mysql_multi/mysql-db3a",
"/var/lib/mysql_multi/mysql-db3b",
"/var/lib/mysql_multi/mysql-db4a",
"/var/lib/mysql_multi/mysql-db4b",
"/var/lib/mysql_multi/mysql-db5a",
"/var/lib/mysql_multi/mysql-db5b",
]
initdatadirs { $release_mysql_datadirs: }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment