forked from icesi-ops/sd-workshop2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
70 lines (65 loc) · 2.5 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
firstDisk = "./firstDirk.vdi"
secondDisk = "./secondDirk.vdi"
thirdDisk = "./thirdDirk.vdi"
Vagrant.configure("2") do |config|
(1..1).each do |i|
config.vm.define "master" do |server|
server.vm.box = "centos/7"
server.vm.network "private_network", ip: "192.168.56.11"
server.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "512", "--cpus", "1",
"--name", "ubuntu-srv-#{i}"]
unless File.exist?(firstDisk)
vb.customize ["createhd", "--filename", firstDisk, "--variant",
"Fixed", "--size", 5*1024]
end
vb.customize ["storageattach", :id, "--storagectl", "IDE",
"--port", 1, "--device", 0, "--type", "hdd","--medium", firstDisk]
end
server.vm.provision "shell", path: "scripts/glusterfs.sh"
server.vm.provision "shell", path: "scripts/configuration.sh"
end
config.vm.define "node1" do |node1|
node1.vm.box = "centos/7"
node1.vm.hostname = "node-1"
node1.vm.network "private_network", ip: "192.168.56.12"
node1.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "512", "--cpus", "1",
"--name", "node-1"]
unless File.exist?(secondDisk)
vb.customize ['createhd', '--filename', secondDisk, '--variant',
'Fixed', '--size', 5 * 1024]
end
vb.customize ['storageattach', :id, '--storagectl', 'IDE', '--port',
1, '--device', 0, '--type', 'hdd', '--medium', secondDisk]
end
node1.vm.provision "shell", path: "scripts/glusterfs.sh"
node1.vm.provision "shell", path: "scripts/configuration.sh"
end
config.vm.define "node2" do |node2|
node2.vm.box = "centos/7"
node2.vm.hostname = "node-2"
node2.vm.network "private_network", ip: "192.168.56.13"
node2.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "512", "--cpus", "1",
"--name", "node-2"]
unless File.exist?(thirdDisk)
vb.customize ['createhd', '--filename', thirdDisk, '--variant',
'Fixed', '--size', 5 * 1024]
end
vb.customize ['storageattach', :id, '--storagectl', 'IDE', '--port',
1, '--device', 0, '--type', 'hdd', '--medium', thirdDisk]
end
node2.vm.provision "shell", path: "scripts/glusterfs.sh"
node2.vm.provision "shell", path: "scripts/configuration.sh"
end
#config.trigger.after :up do |trigger|
# trigger.run = {path: "scripts/sshconfiguration.sh"}
# end
end
config.trigger.after :up do |trigger|
trigger.run = {path: "scripts/sshconfiguration.sh"}
end
end