-
Notifications
You must be signed in to change notification settings - Fork 15
/
Vagrantfile
48 lines (44 loc) · 1.82 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
# enable typed triggers.
# NB this is needed to modify the libvirt domain scsi controller model to virtio-scsi.
ENV['VAGRANT_EXPERIMENTAL'] = 'typed_triggers'
VM_CPUS = 4
VM_MEMORY_MB = 8*1024
VM_OS_DISK_GB = 128
require 'open3'
Vagrant.configure('2') do |config|
config.vm.provider :libvirt do |lv, config|
lv.memory = VM_MEMORY_MB
lv.cpus = VM_CPUS
lv.cpu_mode = 'host-passthrough'
# lv.nested = true
lv.keymap = 'pt'
lv.disk_bus = 'scsi'
lv.disk_device = 'sda'
lv.disk_driver :discard => 'unmap', :cache => 'unsafe'
lv.machine_virtual_size = VM_OS_DISK_GB
config.trigger.before :'VagrantPlugins::ProviderLibvirt::Action::StartDomain', type: :action do |trigger|
trigger.ruby do |env, machine|
# modify the scsi controller model to virtio-scsi.
# see https://github.com/vagrant-libvirt/vagrant-libvirt/pull/692
# see https://github.com/vagrant-libvirt/vagrant-libvirt/issues/999
stdout, stderr, status = Open3.capture3(
'virt-xml', machine.id,
'--edit', 'type=scsi',
'--controller', 'model=virtio-scsi')
if status.exitstatus != 0
raise "failed to run virt-xml to modify the scsi controller model. status=#{status.exitstatus} stdout=#{stdout} stderr=#{stderr}"
end
end
end
end
config.vm.define 'builder' do |config|
config.vm.box = 'windows-2022-amd64'
config.vm.synced_folder '.', '/vagrant',
type: 'smb',
smb_username: ENV['VAGRANT_SMB_USERNAME'] || ENV['USER'],
smb_password: ENV['VAGRANT_SMB_PASSWORD']
config.vm.provision :shell, path: 'provision/ps.ps1', args: 'expand-os-partition.ps1'
config.vm.provision :shell, path: 'provision/ps.ps1', args: 'provision-chocolatey.ps1'
config.vm.provision :shell, path: 'provision/ps.ps1', args: 'provision-base.ps1'
end
end