-
Notifications
You must be signed in to change notification settings - Fork 6
/
Vagrantfile
61 lines (54 loc) · 1.68 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
55
56
57
58
59
60
61
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
$discovery=<<SCRIPT
yum update -y
yum install curl -y
cd /tmp
curl -fsSL get.docker.com -o get-docker.sh
sh get-docker.sh
systemctl enable --now docker
docker rm -f etcd
docker run --restart always --name etcd \
-d --net=host quay.io/coreos/etcd:v3.3 \
/usr/local/bin/etcd \
--listen-client-urls http://192.168.33.10:2379 \
--advertise-client-urls http://192.168.33.10:2379
SCRIPT
$bootstrap=<<SCRIPT
yum update -y
yum install libmnl-devel gcc make kernel-devel wget -y
cd /tmp
wget https://git.zx2c4.com/WireGuard/snapshot/WireGuard-0.0.20180420.tar.xz
tar -xvf WireGuard-0.0.20180420.tar.xz
cd WireGuard-0.0.20180420/src/
make
make install
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
num_nodes = 3
base_ip = "192.168.33."
net_ips = num_nodes.times.collect { |n| base_ip + "#{n+11}" }
config.vm.define "discovery-server" do |discovery|
discovery.vm.box = "centos/7"
discovery.vm.hostname = "discovery-server"
discovery.vm.network :private_network, ip: "192.168.33.10"
discovery.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "512"]
end
discovery.vm.provision :shell, inline: $discovery
end
num_nodes.times do |n|
config.vm.define "net-#{n+1}" do |net|
net.vm.box = "centos/7"
net_ip = net_ips[n]
net_index = n+1
net.vm.hostname = "wirey-node-#{net_index}"
net.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
net.vm.network :private_network, ip: "#{net_ip}"
net.vm.provision :shell, inline: $bootstrap, :args => "#{net_ip}"
end
end
end