-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVagrantfile
More file actions
65 lines (57 loc) · 1.98 KB
/
Vagrantfile
File metadata and controls
65 lines (57 loc) · 1.98 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
54
55
56
57
58
59
60
61
62
63
64
65
# -*- mode: ruby -*-
# vi: set ft=ruby :
hosts = {
"master" => {
"ip" => "192.168.56.10"
},
"worker1" => {
"ip" => "192.168.56.11"
},
"worker2" => {
"ip" => "192.168.56.12"
},
}
# 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.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# Use the default key (insecure key) on all VMs
# instead of generating new ones. More closely emulates Ansible behavior
# in the remote setup.
# Private key path: ~/.vagrant.d/insecure_private_key
config.ssh.insert_key = false
hosts.each do |name, info|
config.vm.define name do |machine|
machine.vm.box = "debian/bullseye64"
machine.vm.hostname = name
machine.vm.network :private_network, ip: info["ip"]
# configure virtualbox characteristics
machine.vm.provider "virtualbox" do |v|
v.name = name
v.customize ["modifyvm", :id, "--memory", 2048]
v.customize ["modifyvm", :id, "--cpus", "2"]
end
# To disable syncing from your host machine to the master VM
# remove or comment out the following three lines
if name == "master"
machine.vm.synced_folder "./projects", "/projects", create: true
end
# You can also edit the section above to sync different locations
# if preferred. More documentation in the following link:
# https://developer.hashicorp.com/vagrant/docs/synced-folders/basic_usage#create
if name == "worker2"
# This is the last server being started.
# Provision the cluster
machine.vm.provision :ansible do |ansible|
# Disable default limit to connect to all machines
ansible.limit = "all"
ansible.playbook = "cluster.yml"
ansible.inventory_path = "hosts.ini"
end
end
end
end
end