forked from vvicaretti/freepto-vagrant
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVagrantfile
65 lines (59 loc) · 2.83 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" # avoids 'stdin: is not a tty' error.
config.ssh.private_key_path = ["#{ENV['HOME']}/.ssh/id_rsa","#{ENV['HOME']}/.vagrant.d/insecure_private_key"]
config.vm.provision "shell", inline: <<-SCRIPT
printf "%s\n" "#{File.read("#{ENV['HOME']}/.ssh/id_rsa.pub")}" > /home/vagrant/.ssh/authorized_keys
chown -R vagrant:vagrant /home/vagrant/.ssh
SCRIPT
config.vm.define "vbox" do|vbox|
vbox.vm.synced_folder "sync/", "/vagrant"
vbox.vm.box = "freepto-vbox"
vbox.vm.box_url = "http://dev.freepto.mx/vagrant/virtualbox/freepto-vbox.box"
vbox.vm.provider "virtualbox" do |vb|
# if BUILD_TYPE is ram, the ram size should be set
# to 6656 (1024 * 6 + 512)
# vb.customize ["modifyvm", :id, "--memory", "6656"]
vb.customize ["modifyvm", :id, "--memory", "2048"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
vb.gui = false
end
end
config.vm.define "kvm" do |kvm|
kvm.vm.box = "freepto-libvirt"
kvm.vm.box_url = "http://dev.freepto.mx/vagrant/libvirt/freepto-libvirt.box"
kvm.vm.synced_folder "sync/", "/vagrant", :nfs => true, :mount_options => ['rw', 'vers=3', 'tcp']
kvm.vm.provider "libvirt" do |domain|
# https://github.com/pradels/vagrant-libvirt
domain.disk_bus = 'ide'
# if BUILD_TYPE is ram, the ram size should be set
# to 6656 (1024 * 6 + 512)
# domain.memory = 6656
domain.memory = 2048
domain.cpus = 2
# https://github.com/torvalds/linux/blob/master/Documentation/virtual/kvm/nested-vmx.txt
domain.nested = false
# Controls the cache mechanism. Possible values are "default", "none", "writethrough", "writeback", "directsync" and "unsafe"
# http://libvirt.org/formatdomain.html#elementsDisks
domain.volume_cache = 'none'
# Arguments passed on to the guest kernel initramfs or initrd to use (Equivalent to qemu -append)
# domain.cmd_line =
end
end
config.vm.provision "shell", path: "sync/provisioning/setup.sh"
end