[GALERA] Prepare Vagrant and variables

pull/14/head
Emilien Mantel 2016-09-23 10:01:02 +02:00
parent 1b58f143fa
commit d6173bd9b5
6 changed files with 26 additions and 9 deletions

19
Vagrantfile vendored
View File

@ -6,14 +6,17 @@
Vagrant.configure("2") do |config| Vagrant.configure("2") do |config|
vms = [ vms = [
["jessie-default-mysql-master", "debian/jessie64", "192.168.200.16", ["jessie","default","mysql","master"]], ["jessie-default-mysql-master", "debian/jessie64", "192.168.200.10", ["jessie","default","mysql","master"]],
["jessie-default-mysql-slave", "debian/jessie64", "192.168.200.17", ["jessie","default","mysql","slave"]], ["jessie-default-mysql-slave", "debian/jessie64", "192.168.200.11", ["jessie","default","mysql","slave"]],
["jessie-upstream-mariadb-master", "debian/jessie64", "192.168.200.18", ["jessie","upstream","mariadb","master"]], ["jessie-upstream-mariadb-master", "debian/jessie64", "192.168.200.12", ["jessie","upstream","mariadb","master"]],
["jessie-upstream-mariadb-slave", "debian/jessie64", "192.168.200.19", ["jessie","upstream","mariadb","slave"]], ["jessie-upstream-mariadb-slave", "debian/jessie64", "192.168.200.13", ["jessie","upstream","mariadb","slave"]],
["jessie-upstream-percona-master", "debian/jessie64", "192.168.200.20", ["jessie","upstream","percona","master"]], ["jessie-upstream-percona-master", "debian/jessie64", "192.168.200.14", ["jessie","upstream","percona","master"]],
["jessie-upstream-percona-slave", "debian/jessie64", "192.168.200.21", ["jessie","upstream","percona","slave"]], ["jessie-upstream-percona-slave", "debian/jessie64", "192.168.200.15", ["jessie","upstream","percona","slave"]],
["jessie-default-mariadb-master", "debian/jessie64", "192.168.200.22", ["jessie","default","mariadb","master"]], ["jessie-default-mariadb-master", "debian/jessie64", "192.168.200.16", ["jessie","default","mariadb","master"]],
["jessie-default-mariadb-slave", "debian/jessie64", "192.168.200.23", ["jessie","default","mariadb","slave"]] ["jessie-default-mariadb-slave", "debian/jessie64", "192.168.200.17", ["jessie","default","mariadb","slave"]],
["jessie-default-mariadb_galera-1", "debian/jessie64", "192.168.200.18", ["jessie","default","mariadb_galera","1"]],
["jessie-default-mariadb_galera-2", "debian/jessie64", "192.168.200.19", ["jessie","default","mariadb_galera","2"]],
["jessie-default-mariadb_galera-3", "debian/jessie64", "192.168.200.20", ["jessie","default","mariadb_galera","3"]]
] ]
config.vm.provider "virtualbox" do |v| config.vm.provider "virtualbox" do |v|

View File

@ -17,6 +17,9 @@ my @a = (
"jessie-upstream-percona-slave", "jessie-upstream-percona-slave",
"jessie-default-mariadb-master", "jessie-default-mariadb-master",
"jessie-default-mariadb-slave", "jessie-default-mariadb-slave",
"jessie-default-mariadb_galera-1",
"jessie-default-mariadb_galera-2",
"jessie-default-mariadb_galera-3"
); );
my $start_ip = '192.168.200.10'; my $start_ip = '192.168.200.10';
@ -34,13 +37,20 @@ foreach my $n (@a)
join(',', map { sprintf('"%s"', $_) } @data) join(',', map { sprintf('"%s"', $_) } @data)
); );
if($data[-1] eq 'slave') if($data[-1] eq 'slave')
{ {
open(FILE, '>', "host_vars/$n"); open(FILE, '>', "host_vars/$n");
printf FILE (qq/his_master: '%s'\n/, $tmp_ip); printf FILE (qq/his_master: '%s'\n/, $tmp_ip);
close(FILE); close(FILE);
} }
if($data[-1] =~ /^\d$/ && $data[-2] eq 'mariadb_galera')
{
open(FILE, '>', "host_vars/$n");
printf FILE (qq/galera_id: '%s'\n/, $data[-1]);
close(FILE);
}
open(FILE, '>', "group_vars/" . $data[2]); open(FILE, '>', "group_vars/" . $data[2]);
printf FILE (qq/mysql_vendor: '%s'\n/, $data[2]); printf FILE (qq/mysql_vendor: '%s'\n/, $data[2]);
close(FILE); close(FILE);

View File

@ -0,0 +1 @@
mysql_vendor: 'mariadb_galera'

View File

@ -0,0 +1 @@
galera_id: '1'

View File

@ -0,0 +1 @@
galera_id: '2'

View File

@ -0,0 +1 @@
galera_id: '3'