forked from mfeit-internet2/scinet-perfsonar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
88 lines (58 loc) · 1.96 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
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
#
# SC19 perfSONAR Deployment Test Boxes
#
hosts = [
[ "publisher", "10.10.1.1", 8081 ],
[ "archive", "10.10.1.2", 8082 ],
[ "maddash", "10.10.1.3", 8083 ],
[ "testpoint", "10.10.1.4", 8084 ],
[ "toolkit", "10.10.1.5", 8085 ],
[ "pwa", "10.10.1.6", 8086 ],
# This is built last so it can provision the others
[ "controller","10.10.1.10", 8090 ]
]
etc_hosts = hosts.map { |host, ip| "#{ip} #{host}" }.join("\n")
Vagrant.configure("2") do |config|
# The default E1000 has a security vulerability.
config.vm.provider "virtualbox" do |vbox|
vbox.default_nic_type = "82543GC"
end
hosts.each do |name, ip, forward|
config.vm.define name do |host|
host.vm.provider "virtualbox" do |vb|
vb.cpus = 2
vb.memory = 4096
# Don't need the guest extensions on this host.
if Vagrant.has_plugin?("vagrant-vbguest")
config.vbguest.auto_update = false
end
end
host.vm.box = "centos/7"
host.vm.hostname = name
host.vm.network "private_network", ip: ip,
virtualbox__intnet: "perfsonar"
host.vm.network "forwarded_port", guest: 80, host: forward
# Fill the hosts file
host.vm.provision "#{name}-hosts", type: "shell", run: "always", inline: <<-SHELL
set -e
fgrep localhost /etc/hosts > /etc/hosts.build
echo "#{etc_hosts}" >> /etc/hosts.build
mv -f /etc/hosts.build /etc/hosts
SHELL
# Account and system setup
host.vm.provision "#{name}-ansible-user", type: "shell", run: "always", inline: <<-SHELL
set -e
cd /vagrant
./build-ansible-account ./ssh/id_rsa.pub
SHELL
# Controller-only setup
if name == "controller"
host.vm.provision "ansible-controller", type: "shell", run: "always", inline: <<-SHELL
set -e
cd /vagrant
./provision-controller
SHELL
end # If controller
end # Config
end # hosts.each
end