2015-07-12 17:15:59 +07:00
|
|
|
# -*- mode: ruby -*-
|
|
|
|
# vi: set ft=ruby :
|
|
|
|
# vi: set tabstop=2 :
|
|
|
|
# vi: set shiftwidth=2 :
|
|
|
|
|
|
|
|
Vagrant.configure("2") do |config|
|
|
|
|
|
2019-08-07 22:41:45 +07:00
|
|
|
vbox_deb_buster = 'debian/buster64'
|
|
|
|
dk_deb_buster = 'hanxhx/vagrant-ansible:debian10'
|
2015-07-12 17:15:59 +07:00
|
|
|
|
2017-06-28 21:15:44 +07:00
|
|
|
config.hostmanager.enabled = true
|
|
|
|
config.hostmanager.manage_host = false
|
|
|
|
config.hostmanager.manage_guest = true
|
|
|
|
config.hostmanager.ignore_private_ip = false
|
|
|
|
config.hostmanager.include_offline = false
|
2015-07-12 17:15:59 +07:00
|
|
|
|
2017-06-28 21:15:44 +07:00
|
|
|
cases = [
|
2019-08-07 22:41:45 +07:00
|
|
|
# ========================
|
|
|
|
# Debian Buster
|
|
|
|
# ========================
|
|
|
|
|
|
|
|
# Default replication
|
|
|
|
{ os_name: 'buster', vbox: vbox_deb_buster, docker: dk_deb_buster, vars: {mariadb_origin: 'default' }, groups: ['master'] },
|
2019-12-29 01:02:41 +07:00
|
|
|
{ os_name: 'buster', vbox: vbox_deb_buster, docker: nil, vars: {mariadb_origin: 'default' }, groups: ['slave'] },
|
2019-08-07 22:41:45 +07:00
|
|
|
|
|
|
|
# Upstream replication
|
|
|
|
{ os_name: 'buster', vbox: vbox_deb_buster, docker: dk_deb_buster, vars: {mariadb_origin: 'upstream' }, groups: ['master'] },
|
2019-12-29 01:02:41 +07:00
|
|
|
{ os_name: 'buster', vbox: vbox_deb_buster, docker: nil, vars: {mariadb_origin: 'upstream' }, groups: ['slave'] },
|
2019-08-07 22:41:45 +07:00
|
|
|
|
|
|
|
# Galera Debian
|
|
|
|
{ os_name: 'buster', vbox: vbox_deb_buster, docker: dk_deb_buster, vars: {mariadb_origin: 'default' }, groups: ['galera', '1'] },
|
|
|
|
{ os_name: 'buster', vbox: vbox_deb_buster, docker: nil, vars: {mariadb_origin: 'default' }, groups: ['galera', '2'] },
|
|
|
|
{ os_name: 'buster', vbox: vbox_deb_buster, docker: nil, vars: {mariadb_origin: 'default' }, groups: ['galera', '3'] },
|
|
|
|
|
|
|
|
# Galera Upstream
|
|
|
|
{ os_name: 'buster', vbox: vbox_deb_buster, docker: dk_deb_buster, vars: {mariadb_origin: 'upstream' }, groups: ['galera', '1'] },
|
|
|
|
{ os_name: 'buster', vbox: vbox_deb_buster, docker: nil, vars: {mariadb_origin: 'upstream' }, groups: ['galera', '2'] },
|
|
|
|
{ os_name: 'buster', vbox: vbox_deb_buster, docker: nil, vars: {mariadb_origin: 'upstream' }, groups: ['galera', '3'] },
|
2017-06-28 21:15:44 +07:00
|
|
|
]
|
2015-07-12 17:15:59 +07:00
|
|
|
|
2017-06-28 21:15:44 +07:00
|
|
|
cases.each_with_index do |opts,index|
|
|
|
|
name = 'docker-' + opts[:os_name] + '-' + opts[:vars].map{|k,v| "#{v}"}.join('-') + '-' + opts[:groups].join('-')
|
|
|
|
iplsb = 10 + index
|
|
|
|
ip = '192.168.201.' + iplsb.to_s
|
|
|
|
next if opts[:docker].nil?
|
|
|
|
|
2018-03-17 23:05:45 +07:00
|
|
|
config.vm.synced_folder ".", "/vagrant", disabled: true
|
2017-06-28 21:15:44 +07:00
|
|
|
config.vm.define name do |m|
|
|
|
|
m.vm.network "private_network", ip: ip
|
|
|
|
m.vm.provider "docker" do |d|
|
|
|
|
d.image = opts[:docker]
|
|
|
|
d.remains_running = true
|
|
|
|
d.has_ssh = true
|
|
|
|
end
|
|
|
|
m.vm.provision "ansible" do |ansible|
|
|
|
|
ansible.playbook = "tests/test.yml"
|
|
|
|
ansible.verbose = 'vv'
|
2018-02-27 13:21:45 +07:00
|
|
|
ansible.become = true
|
2017-06-28 21:15:44 +07:00
|
|
|
ansible.extra_vars = opts[:vars].merge({ is_docker: true })
|
|
|
|
ansible.groups = { opts[:groups][0] => name }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
cases.each_with_index do |opts,index|
|
|
|
|
name = 'vbox-' + opts[:os_name] + '-' + opts[:vars].map{|k,v| "#{v}"}.join('-') + '-' + opts[:groups].join('-')
|
|
|
|
iplsb = 10 + index
|
|
|
|
ip = '192.168.200.' + iplsb.to_s
|
|
|
|
config.vm.define name do |m|
|
|
|
|
m.vm.hostname = name
|
|
|
|
m.vm.box = opts[:vbox]
|
|
|
|
m.vm.network "private_network", ip: ip
|
|
|
|
m.vm.provider "virtualbox" do |v|
|
|
|
|
v.cpus = 1
|
|
|
|
v.memory = 256
|
|
|
|
end
|
|
|
|
m.vm.provision "ansible" do |ansible|
|
|
|
|
ansible.playbook = "tests/test.yml"
|
|
|
|
ansible.verbose = 'vv'
|
2018-02-27 13:21:45 +07:00
|
|
|
ansible.become = true
|
2017-06-28 21:15:44 +07:00
|
|
|
ansible.extra_vars = opts[:vars].merge({ is_docker: false })
|
|
|
|
ansible.groups = { opts[:groups][0] => name }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2015-07-12 17:15:59 +07:00
|
|
|
end
|