-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantfile
More file actions
53 lines (48 loc) · 1.74 KB
/
Vagrantfile
File metadata and controls
53 lines (48 loc) · 1.74 KB
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
BOX_NAME = "bento/ubuntu-24.04" # (Noble Numbat)
MASTER_CPU = 2
MASTER_MEM = 2048
NODE_COUNT = 2
NODE_CPU = 2
NODE_MEM = 2048
# This may need to be updated based on the host network(s) in your VirtualBox set up
IP_BASE = "192.168.56"
Vagrant.configure("2") do |config|
config.vm.define "master" do |master|
master.vm.box = BOX_NAME
master.vm.network "private_network", ip: "#{IP_BASE}.10"
master.vm.hostname = "master"
master.vm.synced_folder ".", "/vagrant", disabled: true
master.vm.provider "virtualbox" do |v|
v.memory = MASTER_MEM
v.cpus = MASTER_CPU
end
master.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible-config/playbook.yaml"
ansible.compatibility_mode = "2.0"
ansible.extra_vars = {
public_ip: "#{IP_BASE}.10",
ansible_python_interpreter: "python3"
}
end
end
(1..NODE_COUNT).each do |i|
config.vm.define "node#{i}" do |node|
node.vm.box = BOX_NAME
node.vm.network "private_network", ip: "#{IP_BASE}.#{10 + i}"
node.vm.hostname = "node#{i}"
node.vm.synced_folder ".", "/vagrant", disabled: true
node.vm.provider "virtualbox" do |v|
v.memory = NODE_MEM
v.cpus = NODE_CPU
end
node.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible-config/playbook.yaml"
ansible.compatibility_mode = "2.0"
ansible.extra_vars = {
public_ip: "#{IP_BASE}.#{10 + i}",
ansible_python_interpreter: "python3"
}
end
end
end
end