-
Notifications
You must be signed in to change notification settings - Fork 3
/
Vagrantfile
52 lines (42 loc) · 1.42 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
host = RbConfig::CONFIG['host_os']
cpus = [2, `getconf _NPROCESSORS_ONLN`.to_i / 2].max
# provide more resources to vm
if host =~ /darwin/
mem = [4096, `sysctl -n hw.memsize`.to_i / 1024 / 1024 / 2].min
elsif host =~ /linux/
mem = [cpus * 512, `awk '/MemTotal/ {print $2}' /proc/meminfo`.to_i / 1024 / 2].min
end
config.vm.box = "generic/ubuntu2004"
config.vm.hostname = "vagrant"
# use NFS for performant file sharing
config.vm.network :private_network, type: "dhcp"
# mount states and pillars to the appropriate locations
config.vm.synced_folder "states/", "/srv/salt/"
config.vm.synced_folder "pillars/", "/srv/pillar/"
# provider specific settings
config.vm.provider "virtualbox" do |vbox, override|
vbox.cpus = cpus
vbox.memory = mem
end
config.vm.provider :libvirt do |libvirt, override|
libvirt.cpus = cpus
libvirt.memory = mem
libvirt.driver = "kvm"
libvirt.cpu_mode = "host-passthrough"
end
config.vm.provision :salt do |salt|
salt.minion_config = "minion"
salt.install_type = "stable"
salt.bootstrap_options = "-n -X"
salt.masterless = true
salt.run_highstate = true
end
config.vm.define "default", primary: true do |default|
end
config.vm.define "debian10", autostart: false do |debian10|
debian10.vm.box = "debian/buster64"
end
end