-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathVagrantfile
54 lines (44 loc) · 1.37 KB
/
Vagrantfile
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
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANT_BOXES = {
ubuntu_bionic: {
box: "ubuntu/bionic64",
box_version: "20190708.0.0"
},
ubuntu_xenial: {
box: "ubuntu/xenial64",
box_version: "20190708.0.0"
},
centos: {
box: "centos/7",
box_version: "1905.01",
},
rhel: {
box: "generic/rhel7",
box_version: "1.9.18",
}
}
count = (ENV["NODE_COUNT"] || 1).to_i
fail("NODE_COUNT must be a positive integer") if count < 1
distro = (ENV["NODE_DISTRO"] || "ubuntu_xenial").to_sym
fail("NODE_DISTRO '#{distro}' is not supported") unless VAGRANT_BOXES.key?(distro)
node_info = VAGRANT_BOXES[distro]
Vagrant.configure("2") do |config|
config.ssh.insert_key = false
config.ssh.private_key_path = ["~/.vagrant.d/insecure_private_key", "~/.ssh/id_rsa"]
config.vm.provision :file, source: "~/.ssh/id_rsa.pub", destination: "~/.ssh/authorized_keys"
config.vm.box_check_update = false
(0...count).each do |i|
config.vm.define "node-#{i}" do |c|
c.vm.box = node_info[:box]
c.vm.box_version = node_info[:box_version]
c.vm.network :private_network, ip: "192.168.50.1#{i}"
c.vm.provider :virtualbox do |vb|
vb.cpus = 2
vb.memory = "4096"
# NOTE: VirtualBox v6.x is SLOW with the following setting
# vb.customize ["modifyvm", :id, "--uartmode1", "disconnected"]
end
end
end
end