-
Notifications
You must be signed in to change notification settings - Fork 27
/
Vagrantfile
82 lines (71 loc) · 2.79 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
# coding: utf-8
# copyright Utrecht University
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Configuration variables.
VAGRANTFILE_API_VERSION = "2"
ENV['VAGRANT_DEFAULT_PROVIDER'] = "libvirt"
BOX = 'alvistack/ubuntu-24.04'
GUI = false
CPU = 2
RAM = 4096
DOMAIN = ".yoda.test"
NETWORK = "192.168.56."
NETMASK = "255.255.255.0"
HOSTS = {
"combined" => [NETWORK+"10", CPU, RAM, GUI, BOX],
}
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.insert_key = false
HOSTS.each do | (name, cfg) |
ipaddr, cpu, ram, gui, box = cfg
config.vm.define name do |machine|
machine.vm.box = box
machine.vm.provider :virtualbox do |vbox|
vbox.gui = gui
vbox.cpus = cpu
vbox.memory = ram
vbox.name = name
vbox.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000]
vbox.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
machine.vm.provider :libvirt do |libvirt|
libvirt.driver = "kvm"
libvirt.cpus = cpu
libvirt.memory = ram
end
machine.vm.hostname = name + DOMAIN
machine.vm.network 'private_network', ip: ipaddr, netmask: NETMASK
machine.vm.synced_folder ".", "/vagrant", disabled: true
machine.vm.provision "shell" do |s|
s.inline = "sudo hostnamectl hostname $1"
s.args = name + DOMAIN
end
machine.vm.provision "shell",
inline: "sudo timedatectl set-timezone Europe/Amsterdam"
machine.vm.provision "shell",
inline: "sudo echo \"192.168.56.10 api.eus.yoda.test\" | sudo tee -a /etc/hosts"
machine.vm.provision "shell",
inline: "sudo echo \"192.168.56.10 datacite-mock.yoda.test\" | sudo tee -a /etc/hosts"
machine.vm.provision "shell",
inline: "sudo echo \"192.168.56.10 sram-mock.yoda.test\" | sudo tee -a /etc/hosts"
end
end
# Provision controller for Ansible on Windows host.
if Vagrant::Util::Platform.windows? then
config.vm.define "controller" do |controller|
controller.vm.provider :virtualbox do |vbox|
vbox.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000]
end
controller.vm.box = 'alvistack/ubuntu-24.04'
controller.vm.hostname = "controller"
controller.vm.network :private_network, ip: "192.168.56.5", netmask: NETMASK
controller.vm.provision "shell", privileged: false, path: "vagrant/provision_controller.sh"
controller.vm.synced_folder ".", "/vagrant", disabled: true
controller.vm.provision "shell",
inline: "sudo timedatectl set-timezone Europe/Amsterdam"
controller.vm.provision "shell",
inline: "sudo echo \"192.168.56.10 eus.yoda.test\" | sudo tee -a /etc/hosts"
end
end
end