test: add network template tests

This commit is contained in:
ajschroeder
2024-12-09 22:39:52 +00:00
parent 6c313c97d9
commit dbc24c6688
15 changed files with 227 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
source "null" "test" {
communicator = "none"
}
locals {
autoinstall = templatefile("${abspath(path.root)}/templates/autoinstall.pkrtpl", {
device = var.vm_network_device,
ip = var.vm_ip_address,
netmask = var.vm_ip_netmask,
gateway = var.vm_ip_gateway,
dns = var.vm_dns_list,
})
kickstart = templatefile("${abspath(path.root)}/templates/kickstart.pkrtpl", {
device = var.vm_network_device,
ip = var.vm_ip_address,
netmask = var.vm_ip_netmask,
gateway = var.vm_ip_gateway,
dns = var.vm_dns_list,
})
preseed = templatefile("${abspath(path.root)}/templates/preseed.pkrtpl", {
device = var.vm_network_device,
ip = var.vm_ip_address,
netmask = var.vm_ip_netmask,
gateway = var.vm_ip_gateway,
dns = var.vm_dns_list,
})
}
build {
name = "autoinstall"
sources = ["source.null.test"]
provisioner "shell-local" {
inline = [
"echo '${local.autoinstall}' > ${var.output_folder}/autoinstall",
]
}
}
build {
name = "kickstart"
sources = ["source.null.test"]
provisioner "shell-local" {
inline = [
"echo '${local.kickstart}' > ${var.output_folder}/kickstart",
]
}
}
build {
name = "preseed"
sources = ["source.null.test"]
provisioner "shell-local" {
inline = [
"echo '${local.preseed}' > ${var.output_folder}/preseed",
]
}
}