forked from koniiiik/oi-live
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
executable file
·48 lines (41 loc) · 1.73 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
%x[mkdir -p ./output]
config.ssh.insert_key = false
# Two machines will be provisioned
# First will be the OI-Live source installation
config.vm.define "oilive", primary: true do |oilive|
oilive.vm.box = "ogarcia/archlinux-x64"
oilive.vm.box_check_update = false
oilive.vm.synced_folder "./output", "/vagrant"
oilive.vm.provider "virtualbox" do |vb|
vb.memory = 4096
vb.cpus = 4
end
end
# Magic shell command to find location of oilive virtual disk
disk_file = %x[[ -f .vagrant/machines/oilive/virtualbox/id ] && VBoxManage showvminfo --machinereadable `cat .vagrant/machines/oilive/virtualbox/id` | grep "IDE Controller-0-0" | awk -F'=' '{ORS=""} {print $2}' | sed -e 's/^"//' -e 's/"$//']
# Second will contain the tools for building the image from the
# first one's virtual disk connected as a second drive.
config.vm.define "builder", autostart: false do |builder|
builder.vm.box = "archlinux/archlinux" # Use different base box to avoid boot-time UUID conflicts
builder.vm.box_check_update = false
builder.vm.synced_folder "./output", "/vagrant"
builder.vm.provider "virtualbox" do |vb|
vb.memory = 4096
vb.cpus = 4
if disk_file.length > 0 then
vb.customize ['storageattach', :id, '--storagectl', 'IDE Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', disk_file]
end
end
end
config.vm.provision "shell", inline: "sudo pacman -Sy --noconfirm --needed python2"
config.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible/playbook.yml"
ansible.groups = {
"oilive" => ["oilive"],
"builder" => ["builder"]
}
end
end