From d6173bd9b570e209d6fb4fc20d26f0b9ed3480cc Mon Sep 17 00:00:00 2001 From: Emilien Mantel Date: Fri, 23 Sep 2016 10:01:02 +0200 Subject: [PATCH] [GALERA] Prepare Vagrant and variables --- Vagrantfile | 19 +++++++++++-------- tests/gen.pl | 12 +++++++++++- tests/group_vars/mariadb_galera | 1 + .../host_vars/jessie-default-mariadb_galera-1 | 1 + .../host_vars/jessie-default-mariadb_galera-2 | 1 + .../host_vars/jessie-default-mariadb_galera-3 | 1 + 6 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 tests/group_vars/mariadb_galera create mode 100644 tests/host_vars/jessie-default-mariadb_galera-1 create mode 100644 tests/host_vars/jessie-default-mariadb_galera-2 create mode 100644 tests/host_vars/jessie-default-mariadb_galera-3 diff --git a/Vagrantfile b/Vagrantfile index e755a47..ce9bb47 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -6,14 +6,17 @@ Vagrant.configure("2") do |config| vms = [ - ["jessie-default-mysql-master", "debian/jessie64", "192.168.200.16", ["jessie","default","mysql","master"]], - ["jessie-default-mysql-slave", "debian/jessie64", "192.168.200.17", ["jessie","default","mysql","slave"]], - ["jessie-upstream-mariadb-master", "debian/jessie64", "192.168.200.18", ["jessie","upstream","mariadb","master"]], - ["jessie-upstream-mariadb-slave", "debian/jessie64", "192.168.200.19", ["jessie","upstream","mariadb","slave"]], - ["jessie-upstream-percona-master", "debian/jessie64", "192.168.200.20", ["jessie","upstream","percona","master"]], - ["jessie-upstream-percona-slave", "debian/jessie64", "192.168.200.21", ["jessie","upstream","percona","slave"]], - ["jessie-default-mariadb-master", "debian/jessie64", "192.168.200.22", ["jessie","default","mariadb","master"]], - ["jessie-default-mariadb-slave", "debian/jessie64", "192.168.200.23", ["jessie","default","mariadb","slave"]] + ["jessie-default-mysql-master", "debian/jessie64", "192.168.200.10", ["jessie","default","mysql","master"]], + ["jessie-default-mysql-slave", "debian/jessie64", "192.168.200.11", ["jessie","default","mysql","slave"]], + ["jessie-upstream-mariadb-master", "debian/jessie64", "192.168.200.12", ["jessie","upstream","mariadb","master"]], + ["jessie-upstream-mariadb-slave", "debian/jessie64", "192.168.200.13", ["jessie","upstream","mariadb","slave"]], + ["jessie-upstream-percona-master", "debian/jessie64", "192.168.200.14", ["jessie","upstream","percona","master"]], + ["jessie-upstream-percona-slave", "debian/jessie64", "192.168.200.15", ["jessie","upstream","percona","slave"]], + ["jessie-default-mariadb-master", "debian/jessie64", "192.168.200.16", ["jessie","default","mariadb","master"]], + ["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| diff --git a/tests/gen.pl b/tests/gen.pl index ef25c00..dd8b8aa 100755 --- a/tests/gen.pl +++ b/tests/gen.pl @@ -17,6 +17,9 @@ my @a = ( "jessie-upstream-percona-slave", "jessie-default-mariadb-master", "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'; @@ -34,13 +37,20 @@ foreach my $n (@a) join(',', map { sprintf('"%s"', $_) } @data) ); - if($data[-1] eq 'slave') + if($data[-1] eq 'slave') { open(FILE, '>', "host_vars/$n"); printf FILE (qq/his_master: '%s'\n/, $tmp_ip); 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]); printf FILE (qq/mysql_vendor: '%s'\n/, $data[2]); close(FILE); diff --git a/tests/group_vars/mariadb_galera b/tests/group_vars/mariadb_galera new file mode 100644 index 0000000..9f6d935 --- /dev/null +++ b/tests/group_vars/mariadb_galera @@ -0,0 +1 @@ +mysql_vendor: 'mariadb_galera' diff --git a/tests/host_vars/jessie-default-mariadb_galera-1 b/tests/host_vars/jessie-default-mariadb_galera-1 new file mode 100644 index 0000000..3777c41 --- /dev/null +++ b/tests/host_vars/jessie-default-mariadb_galera-1 @@ -0,0 +1 @@ +galera_id: '1' diff --git a/tests/host_vars/jessie-default-mariadb_galera-2 b/tests/host_vars/jessie-default-mariadb_galera-2 new file mode 100644 index 0000000..e7a5643 --- /dev/null +++ b/tests/host_vars/jessie-default-mariadb_galera-2 @@ -0,0 +1 @@ +galera_id: '2' diff --git a/tests/host_vars/jessie-default-mariadb_galera-3 b/tests/host_vars/jessie-default-mariadb_galera-3 new file mode 100644 index 0000000..d29e3bd --- /dev/null +++ b/tests/host_vars/jessie-default-mariadb_galera-3 @@ -0,0 +1 @@ +galera_id: '3'