-
Notifications
You must be signed in to change notification settings - Fork 12
/
Vagrantfile.multi-instances
202 lines (189 loc) · 7.5 KB
/
Vagrantfile.multi-instances
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# PXC=5.6.45-28.36.1 PXC56GALERA=3-3.36-1 PXB=2.3.9-1 vagrant up --provider=lxc
PS = ENV["PS"] || "" # "5.6.47-rel87.0.1" "5.7.29-32.1" "8.0.18-9.1"
ROCKSDB = ENV["ROCKSDB"] || "" # "1"
PXC = ENV["PXC"] || "" # "5.6.45-28.36.1" "5.7.22-29.26.1" "8.0.18-9.3"
PXC_GALERA = ENV["PXC_GALERA"] || "" # "3-3.36-1"
PXB = ENV["PXB"] || "" # "2.3.9-1"
PSMDB = ENV["PSMDB"] || "" # "3.6.16-3.6"
PBM = ENV["PBM"] || "" # "1.1.1-1"
PMM_SERVER = ENV["PMM_SERVER"] || "" # "2.5.0"
PMM_CLIENT = ENV["PMM_CLIENT"] || "" # "2.5.0-6"
PMM_URL = ENV["PMM_URL"] || ""
PPGSQL = ENV["PPGSQL"] || "" # "11.7-2"
PGPOOL = ENV["PGPOOL"] || "" # "4.1.2-1"
PT = ENV["PT"] || "" # "3.2.0-1"
DB_USER = ENV["DB_USER"] || ""
DB_PASS = ENV["DB_PASS"] || ""
DB_FEATURES = ENV["DB_FEATURES"] || ""
PKO4PXC = ENV["PKO4PXC"] || ""
PKO4PSMDB = ENV["PKO4PSMDB"] || ""
START = ENV["START"] || "" # START=1 to start systemd service automatically
DB_OPTS = ENV["DB_OPTS"] || "" # DB_OPTS=mysql/mysql-async-repl-gtid.cnf
LXD_PROFILE = ENV["LXD_PROFILE"] || "default"
OS = ENV["OS"] || "centos/7"
K3S = ENV["K3S"] || ""
K8S_PMM = ENV["K8S_PMM"] || ""
K8S_MINIO = ENV["K8S_MINIO"] || ""
K3S_FLANNEL_BACKEND = ENV["K3S_FLANNEL_BACKEND"] || "vxlan"
KUBE_CONFIG = ENV["KUBE_CONFIG"] || ""
DB_IP = ENV["DB_IP"] || ""
REPLICATION_TYPE = ENV["REPLICATION_TYPE"] || ""
CLUSTER = ENV["CLUSTER"] || "cluster1"
REPLICA_SET = ENV["REPLICA_SET"] || ""
PROXYSQL = ENV["PROXYSQL"] || ""
PERCONA_PROXYSQL = ENV["PERCONA_PROXYSQL"] || ""
MARIADB = ENV["MARIADB"] || ""
MYSQL = ENV["MYSQL"] || ""
ORCHESTRATOR = ENV["ORCHESTRATOR"] || ""
DEBUG_PACKAGES = ENV["DEBUG_PACKAGES"] || ""
SYSBENCH = ENV["SYSBENCH"] || ""
MYSQL_RANDOM_DATA = ENV["MYSQL_RANDOM_DATA"] || ""
MYSQL_JAVA = ENV["MYSQL_JAVA"] || ""
INNODB_RUBY = ENV["INNODB_RUBY"] || ""
LDAP_SERVER = ENV["LDAP_SERVER"] || ""
LDAP_IP = ENV["LDAP_IP"] || ""
SAMBA_AD = ENV["SAMBA_AD"] || ""
SAMBA_IP = ENV["SAMBA_IP"] || ""
SAMBA_SID = ENV["SAMBA_SID"] || ""
SAMBA_PASS = ENV["SAMBA_PASS"] || ""
MYDUMPER = ENV["MYDUMPER"] || "" # 0.9.5-2
PG = ENV["PG"] || ""
ODYSSEY = ENV["ODYSSEY"] || ""
WALG = ENV["WALG"] || ""
# get token from master k3s node: cat /var/lib/rancher/k3s/server/node-token
# if node re-added, kubectl delete node node1, and remove old entry from /var/lib/rancher/k3s/server/cred/node-passwd before run
K3S_TOKEN = ENV["K3S_TOKEN"] || ""
K3S_URL = ENV["K3S_URL"] || ""
if OS == "centos/7"
LXC_BOX = "visibilityspots/centos-7.x-minimal"
elsif OS == "centos/8"
LXC_BOX = "visibilityspots/centos-8.x-minimal"
elsif OS == "ubuntu/bionic64"
LXC_BOX = "emptybox/ubuntu-bionic-amd64-lxc"
elsif OS == "ubuntu/focal64"
LXC_BOX = "ubuntu/focal64"
end
Vagrant.configure("2") do |config|
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.box = OS
config.vm.provider "lxc" do |lxc, override|
override.vm.box = LXC_BOX
# https://app.vagrantup.com/visibilityspots/boxes/centos-7.x-minimal
# override.vm.box_version = "7.7.0"
#lxc.backingstore = 'dir'
#lxc.backingstore_option '--dir','/bigdisk/lxc'
end
config.vm.provider "virtualbox" do |v|
v.memory = 1024
v.cpus = 2
end
config.vm.provider "lxd" do |lxd, override|
lxd.nesting = true
lxd.privileged = true
lxd.profiles = [ LXD_PROFILE ]
override.vm.box = LXC_BOX
end
config.vm.provision "shell" do |s|
s.inline = "(grep -q vagrant /etc/passwd || useradd -m vagrant );mkdir -p /vagrant ; chown vagrant:adm /vagrant; chmod g+w -R /vagrant"
s.privileged = true
end
config.vm.provision "file", source: "playbook.yml", destination: "/vagrant/playbook.yml"
config.vm.provision "file", source: "configs", destination: "/vagrant/configs"
config.vm.provision "file", source: "tools", destination: "/vagrant/tools"
config.vm.provision "file", source: "common", destination: "/vagrant/common"
config.vm.provision "file", source: "secret", destination: "/vagrant/secret"
config.vm.provision "ansible_local" do |ansible|
ansible.compatibility_mode = "2.0"
ansible.playbook = "playbook.yml"
ansible.verbose = false
ansible.extra_vars = {
extra_percona_server_version: PS,
extra_rocksdb_enabled: ROCKSDB,
extra_percona_xtrabackup_version: PXB,
extra_percona_xtradb_cluster_version: PXC,
extra_percona_xtradb_cluster_galera: PXC_GALERA,
extra_psmdb_version: PSMDB,
extra_pbm_version: PBM,
extra_pmm_server_version: PMM_SERVER,
extra_pmm_client_version: PMM_CLIENT,
extra_pmm_url: PMM_URL,
extra_percona_postgresql_version: PPGSQL,
extra_pgpool_version: PGPOOL,
extra_percona_toolkit_version: PT,
extra_db_user: DB_USER,
extra_db_password: DB_PASS,
extra_db_features: DB_FEATURES,
extra_percona_k8s_op_pxc_version: PKO4PXC,
extra_percona_k8s_op_psmdb_version: PKO4PSMDB,
extra_start_db: START,
extra_db_opts_file: DB_OPTS,
extra_k3s_token: K3S_TOKEN,
extra_k3s_url: K3S_URL,
extra_k3s_version: K3S,
extra_k8s_pmm: K8S_PMM,
extra_k8s_minio: K8S_MINIO,
extra_k3s_flannel_backend: K3S_FLANNEL_BACKEND,
extra_kube_config: KUBE_CONFIG,
extra_master_ip: DB_IP,
extra_replication_type: REPLICATION_TYPE,
extra_cluster_name: CLUSTER,
extra_mongo_replicaset: REPLICA_SET,
extra_proxysql_version: PROXYSQL,
extra_percona_proxysql_version: PERCONA_PROXYSQL,
extra_mariadb_version: MARIADB,
extra_mysql_version: MYSQL,
extra_orchestrator_version: ORCHESTRATOR,
extra_debug_packages: DEBUG_PACKAGES,
extra_sysbench_version: SYSBENCH,
extra_mysql_random_data_load_version: MYSQL_RANDOM_DATA,
extra_mysql_connector_java_version: MYSQL_JAVA,
extra_innodb_ruby_version: INNODB_RUBY,
extra_ldap_server: LDAP_SERVER,
extra_ldap_server_ip: LDAP_IP,
extra_samba_ad: SAMBA_AD,
extra_samba_ip: SAMBA_IP,
extra_samba_sid: SAMBA_SID,
extra_samba_pass: SAMBA_PASS,
extra_mydumper_version: MYDUMPER,
extra_postgresql_version: PG,
extra_odyssey_version: ODYSSEY,
extra_walg_version: WALG,
}
end
config.vm.define "default", primary: true do |default|
default.vm.hostname = "default"
default.vm.provider "virtualbox" do |virtualbox, override|
override.vm.network "private_network", ip: "192.168.38.4", virtualbox__intnet: true
end
end
config.vm.define "node1", autostart: false do |node1|
node1.vm.hostname = "node1"
node1.vm.provider "virtualbox" do |virtualbox, override|
override.vm.network "private_network", ip: "192.168.38.5", virtualbox__intnet: true
end
end
config.vm.define "node2", autostart: false do |node2|
node2.vm.hostname = "node2"
node2.vm.provider "virtualbox" do |virtualbox, override|
override.vm.network "private_network", ip: "192.168.38.6", virtualbox__intnet: true
end
end
config.vm.define "node3", autostart: false do |node3|
node3.vm.hostname = "node3"
node3.vm.provider "virtualbox" do |virtualbox, override|
override.vm.network "private_network", ip: "192.168.38.7", virtualbox__intnet: true
end
end
config.vm.define "node4", autostart: false do |node4|
node4.vm.hostname = "node4"
node4.vm.provider "virtualbox" do |virtualbox, override|
override.vm.network "private_network", ip: "192.168.38.8", virtualbox__intnet: true
end
end
config.vm.define "node5", autostart: false do |node5|
node5.vm.hostname = "node5"
node5.vm.provider "virtualbox" do |virtualbox, override|
override.vm.network "private_network", ip: "192.168.38.9", virtualbox__intnet: true
end
end
end