-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vagrantfile
134 lines (125 loc) · 4.33 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
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
#
# Setup
# =====
# ceph-admin-node - runs ceph-deploy. Ceph public network.
#
# ceph-osd1 - hosts OSD1. Ceph public and cluster network.
# Also hosts MON, MGR and MDS for now.
# ceph-osd2 - hosts OSD2. Ceph public and cluster network.
# ceph-osd3 - hosts OSD3. Ceph public and cluster network.
# :
#
# ceph-export1 - Ceph public network and export network.
# Mounts and exports RBD block device.
# :
#
# ceph-export-client1 - Export network only. Mounts NFS export from ceph-export
# :
#
#
NMONS=0
NMGRS=0
NMDSS=0
NEXPS=1
NECLS=1
NOSDS=3
EXPORT_SUBNET ="192.168.41"
PUBLIC_SUBNET ="192.168.42"
CLUSTER_SUBNET="192.168.43"
MEMORY=1024
Vagrant.configure("2") do |config|
config.vm.box = "debian/contrib-stretch64"
# config.hostmanager.enabled = true
# config.hostmanager.manage_host = false
# config.hostmanager.manage_guest = true
# config.hostmanager.ignore_private_ip = false
# config.hostmanager.include_offline = true
# Create cluster Ansible node connected to everything
config.vm.define "ceph-ansible-node" do |node|
node.vm.hostname = "ceph-ansible-node"
node.vm.network :private_network, ip: "#{PUBLIC_SUBNET}.8"
node.vm.network :private_network, ip: "#{CLUSTER_SUBNET}.8"
node.vm.network :private_network, ip: "#{EXPORT_SUBNET}.8"
node.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
end
end
# Create ceph admin node
config.vm.define "ceph-admin-node" do |node|
node.vm.hostname = "ceph-admin-node"
node.vm.network :private_network, ip: "#{PUBLIC_SUBNET}.9"
node.vm.network :private_network, ip: "#{CLUSTER_SUBNET}.9"
node.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
end
end
# Create NFS export mount nodes. These export RDB mounts to an external network.
(0..NEXPS - 1).each do |i|
config.vm.define "ceph-nexp#{i}" do |node|
node.vm.hostname = "ceph-nexp#{i}"
node.vm.network :private_network, ip: "#{PUBLIC_SUBNET}.2#{i}"
node.vm.network :private_network, ip: "#{EXPORT_SUBNET}.2#{i}"
node.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
end
end
end
# Create NFS client nodes. These mount NFS exports of mounts of RDB block devices.
(0..NECLS - 1).each do |i|
config.vm.define "ceph-ncli#{i}" do |node|
node.vm.hostname = "ceph-ncli#{i}"
node.vm.network :private_network, ip: "#{EXPORT_SUBNET}.3#{i}"
node.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
end
end
end
# Create dedicated MON nodes. MON nodes are used to map names to object
# store locations.
(0..NMONS - 1).each do |i|
config.vm.define "mon#{i}" do |mon|
mon.vm.hostname = "mon#{i}"
mon.vm.network :private_network, ip: "#{PUBLIC_SUBNET}.1#{i}"
mon.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
end
end
end
# Create any dedicared MDS nodes. MDS is used by CephFS
(0..NMDSS - 1).each do |i|
config.vm.define "mds#{i}" do |mds|
mds.vm.hostname = "mds#{i}"
mds.vm.network :private_network, ip: "#{PUBLIC_SUBNET}.7#{i}"
mds.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
end
end
end
# Create OSDs
(0..NOSDS - 1).each do |i|
config.vm.define "ceph-osd#{i}" do |osd|
osd.vm.hostname = "ceph-osd#{i}"
osd.vm.network :private_network, ip: "#{PUBLIC_SUBNET}.10#{i}"
osd.vm.network :private_network, ip: "#{CLUSTER_SUBNET}.20#{i}"
osd.vm.provider :virtualbox do |vb|
unless File.exist?("disk-#{i}-0.vdi")
vb.customize ['storagectl', :id,
'--name', 'OSD Controller',
'--add', 'scsi']
end
(0..1).each do |d|
vb.customize ['createhd',
'--filename', "disk-#{i}-#{d}",
'--size', '11000'] unless File.exist?("disk-#{i}-#{d}.vdi")
vb.customize ['storageattach', :id,
'--storagectl', 'OSD Controller',
'--port', 3 + d,
'--device', 0,
'--type', 'hdd',
'--medium', "disk-#{i}-#{d}.vdi"]
end
vb.customize ['modifyvm', :id, '--memory', "#{MEMORY}"]
end
end
end
end