-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vagrantfile
62 lines (54 loc) · 1.9 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
CEPH_NODES = 3
DISKS = 1
DISKSIZE = "50G"
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
# config.vm.box = "fedora/31-cloud-base"
config.vm.provider "libvirt" do |lv|
lv.cpus = "2"
lv.memory = "1024"
# Always use system connection instead of QEMU session
lv.qemu_use_session = false
end
# disable default sync dir
config.vm.synced_folder ".", "/vagrant", disabled: true
# Uncomment the below lines if you want dedicated ceph-admin node
#config.vm.define "ceph-admin" do |node|
# node.vm.hostname = "ceph-admin"
# localoctet = 100+CEPH_NODES+1
# node.vm.network :private_network, ip: "192.168.50.#{localoctet}"
#end
(1..CEPH_NODES).each do |i|
config.vm.define "ceph-node#{i}" do |node|
node.vm.hostname = "ceph-node#{i}"
localoctet = 100+i
node.vm.network :private_network, ip: "192.168.50.#{localoctet}"
node.vm.provider "libvirt" do |provider|
for _ in 0..DISKS-1 do
provider.storage :file, :size => DISKSIZE
end
end
# Only execute the Ansible provisioner once,
# when all the machines are up and ready.
if i == CEPH_NODES
node.vm.provision :ansible do |ansible|
ansible.groups = {
"ceph_nodes" => (1..CEPH_NODES).map {|j| "ceph-node#{j}"},
# If you want a dedicated ceph-admin node,
# modify 's/ceph-node1/ceph-admin/' at below line
"ceph_admin" => ["ceph-node1"]
}
# Disable default limit to connect to all the machines
ansible.limit = "all"
ansible.playbook = "ansible/playbook.yml"
end
end
end
end
end