Skip to content

Instantly share code, notes, and snippets.

@tfcollins
Last active October 11, 2023 23:36
Show Gist options
  • Save tfcollins/3e520c840df4d9a278e6c2b32dba58e5 to your computer and use it in GitHub Desktop.
Save tfcollins/3e520c840df4d9a278e6c2b32dba58e5 to your computer and use it in GitHub Desktop.
Vagrant.configure("2") do |config|
config.vm.provider :libvirt do |libvirt|
libvirt.disk_bus = "virtio"
libvirt.driver = "kvm"
libvirt.graphics_type = "spice"
libvirt.nic_model_type = "virtio"
libvirt.sound_type = "ich6"
libvirt.video_type = "qxl"
libvirt.channel :type => 'spicevmc', :target_name => 'com.redhat.spice.0', :target_type => 'virtio'
libvirt.channel :type => 'unix', :target_name => 'org.qemu.guest_agent.0', :target_type => 'virtio'
libvirt.random :model => 'random'
# Enable Hyper-V enlightments: https://blog.wikichoon.com/2014/07/enabling-hyper-v-enlightenments-with-kvm.html
# stimer can not be enabled because it needs clock / hypervclock (https://bugzilla.redhat.com/show_bug.cgi?id=1816670) settings which are not supported by vagrant-libvirt
# https://github.com/ruzickap/packer-templates/issues/154
# libvirt.hyperv_feature :name => 'stimer', :state => 'on'
libvirt.hyperv_feature :name => 'synic', :state => 'on'
libvirt.hyperv_feature :name => 'vapic', :state => 'on'
libvirt.hyperv_feature :name => 'vpindex', :state => 'on'
libvirt.memory = 8192
libvirt.cpus = 4
end
# Port forward for RDP
config.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct:true
# Port forward for WinRM
config.vm.network :forwarded_port, guest: 5986, host: 5986, id: "winrm-ssl", auto_correct:true
config.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct:true
config.vm.box = "win10-gh"
config.vm.boot_timeout = 1000
config.vm.communicator = "winrm"
config.vm.guest = :windows
config.windows.halt_timeout = 15
config.winrm.password = "vagrant"
config.winrm.retry_limit = 30
config.winrm.username = "vagrant"
# Disable NFS sharing (==> default: Mounting NFS shared folders...)
config.vm.synced_folder ".", "/vagrant", type: "nfs", disabled: true
config.vm.synced_folder ".", "/vagrant", disabled: true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment