Libvirt provider

Adding Packer Qemu builder:
* Packer/answer_files/*_virtio: Install the virtio drivers from the ISO (NOT provided)
* windows_*.json needs some manual tweaks to match the virtio drivers ISO path

Adding Vagrant-libvirt provider:
* Uses the QEMU qcow2 images provided by packer to build the DetectionLab
* Vagrantfile needs manual tweaking to match libvirt's host configuration (backing store, network interfaces, etc)

README:
* Added separate README with instructions for libvirt
This commit is contained in:
Selora
2019-04-24 11:30:47 -04:00
committed by Selora
parent 4d13f53866
commit 2a6cb92f51
10 changed files with 865 additions and 9 deletions

View File

@@ -1,10 +1,32 @@
# Source: https://github.com/StefanScherer/adfs2
param ([String] $ip, [String] $dns)
param ([String] $ip, [String] $dns, [String] $gateway)
if (! (Test-Path 'C:\Program Files\VMware\VMware Tools')) {
if ( (Get-NetAdapter | Select-Object -First 1 | Select-Object -ExpandProperty InterfaceDescription).Contains('Red Hat VirtIO')) {
Write-Host "Setting Network Configuration for LibVirt interface"
$subnet = $ip -replace "\.\d+$", ""
$name = (Get-NetIPAddress -AddressFamily IPv4 `
| Where-Object -FilterScript { ($_.IPAddress).StartsWith("$subnet") } `
).InterfaceAlias
if ($name) {
Write-Host "Set IP address to $ip of interface $name"
& netsh.exe int ip set address "$name" static $ip 255.255.255.0 "$gateway"
if ($dns) {
Write-Host "Set DNS server address to $dns of interface $name"
& netsh.exe interface ipv4 add dnsserver "$name" address=$dns index=1
}
} else {
Write-Error "Could not find a interface with subnet $subnet.xx"
}
exit 0
}
if (! (Test-Path 'C:\Program Files\VMware\VMware Tools') ) {
Write-Host "Nothing to do for other providers than VMware."
exit 0
}
Write-Host "$('[{0:HH:mm}]' -f (Get-Date))"
Write-Host "Setting IP address and DNS information for the Ethernet1 interface"
Write-Host "If this step times out, it's because vagrant is connecting to the VM on the wrong interface"