-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vagrantfile
69 lines (58 loc) · 2.07 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
# coding: utf-8
# copyright Utrecht University
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Configuration variables.
VAGRANTFILE_API_VERSION = "2"
ENV['VAGRANT_DEFAULT_PROVIDER'] = "libvirt"
BOX = 'generic/ubuntu2004'
GUI = false
CPU = 2
RAM = 2048
DOMAIN = ".ckan.test"
NETWORK = "192.168.60."
NETMASK = "255.255.255.0"
HOSTS = {
"cd2" => [NETWORK+"30", 2, 2048, 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]
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",
inline: "sudo timedatectl set-timezone Europe/Amsterdam"
end
end
# Provision controller for Ansible on Windows host.
if Vagrant::Util::Platform.windows? then
config.vm.define "cd2-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 = BOX
controller.vm.hostname = "cd2-controller"
controller.vm.network :private_network, ip: NETWORK + "35", netmask: NETMASK
controller.vm.synced_folder ".", "/vagrant", disabled: true
controller.vm.provision "shell", privileged: false, path: "vagrant/provision_controller.sh"
controller.vm.provision "shell",
inline: "sudo timedatectl set-timezone Europe/Amsterdam"
end
end
end