.
This commit is contained in:
parent
92a04af990
commit
dac4962ace
@ -26,7 +26,7 @@ data "http" "image_checksum" {
|
||||
|
||||
locals {
|
||||
image_checksum = split(" ",data.http.image_checksum)[0]
|
||||
libvirt_uri = "qemu+ssh://${var.host_ssh_user}@${host_ssh_address}/system"
|
||||
libvirt_uri = "qemu+ssh://${var.host_ssh_user}@${var.host_ssh_address}/system"
|
||||
nvram_path = "${var.nvram_path_base}/${var.guest_hostname}_VARS.fd"
|
||||
cidata_name = "${var.volume_name}_cidata"
|
||||
}
|
||||
@ -49,7 +49,7 @@ source "libvirt" "arch-minimal" {
|
||||
loader_path = var.loader_path
|
||||
nvram_template = var.nvmram_template
|
||||
nvram_path = local.nvram_path
|
||||
secure_boot = true
|
||||
secure_boot = var.secure_boot
|
||||
|
||||
volume {
|
||||
alias = "artifact"
|
||||
@ -95,13 +95,20 @@ source "libvirt" "arch-minimal" {
|
||||
}))
|
||||
|
||||
network_config = jsonencode({
|
||||
renderer = "networkd"
|
||||
version = 2
|
||||
ethernets = {
|
||||
eth = {
|
||||
eth0 = {
|
||||
match = {
|
||||
name = "en*"
|
||||
}
|
||||
dhcp4 = true
|
||||
dhcp4 = false
|
||||
addresses = [${var.network_address}]
|
||||
gateway4 = ${var.network_gateway}
|
||||
nameservers = {
|
||||
addresses = [${var.network_nameserver}]
|
||||
search = [${var.network_domain}]
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -20,9 +20,16 @@ volume_name = "arch_minimal_template"
|
||||
volume_pool = "default"
|
||||
volume_capacity = "30G"
|
||||
|
||||
bridge_name = "br0"
|
||||
bridge_name = "br21"
|
||||
|
||||
ssh_source = "192.168.20.0/24"
|
||||
|
||||
guest_ssh_user = "arch"
|
||||
guest_ssh_port = 22
|
||||
guest_ssh_private_key = "~/.ssh/conf.d/home/arch@arch_template.key"
|
||||
guest_ssh_public_key = "~/.ssh/conf.d/home/arch@arch_template.key.pub"
|
||||
|
||||
network_address = "192.168.21.200/24"
|
||||
network_gateway = "192.168.20.254"
|
||||
network_nameserver = "192.168.30.20"
|
||||
network_domain = "balsillie.net"
|
@ -8,11 +8,117 @@ variable "checksum_url" {
|
||||
description = "The URL to retrieve the checksum value of the backing image from."
|
||||
}
|
||||
|
||||
variable "hostname" {
|
||||
variable "cpu_count" {
|
||||
type = number
|
||||
description = "Number of vCPUs to create guest with."
|
||||
}
|
||||
|
||||
variable "memory" {
|
||||
type = number
|
||||
description = "Amount of RAM in MiB to create guest with."
|
||||
}
|
||||
|
||||
variable "domain_type" {
|
||||
type = string
|
||||
description = "Type of hypervisor to use."
|
||||
default = "kvm"
|
||||
}
|
||||
|
||||
variable "arch" {
|
||||
type = string
|
||||
description = "Domain architecture."
|
||||
default = "x86_64"
|
||||
}
|
||||
|
||||
variable "chipset" {
|
||||
type = string
|
||||
description = "Libvirt Machine Type Value for domain XML's machine type."
|
||||
default = "q35"
|
||||
}
|
||||
|
||||
variable "loader_type" {
|
||||
type = string
|
||||
description = "Where loader should be stored in guest. rom or pflash"
|
||||
default = "pflash"
|
||||
}
|
||||
|
||||
variable "loader_path" {
|
||||
type = string
|
||||
description = "File path where the OVMF firmware files are stored on the host."
|
||||
}
|
||||
|
||||
variable "secure_boot" {
|
||||
type = bool
|
||||
description = "Whether to enable secure boot."
|
||||
}
|
||||
|
||||
variable "nvram_template" {
|
||||
type = string
|
||||
description = "File path where the OVMF_VARS template file is stored on the host."
|
||||
}
|
||||
|
||||
variable "nvram_path_base" {
|
||||
type = string
|
||||
description = "Parent dir where the guest OVMF_VARS copy will be stored. No trailing /"
|
||||
}
|
||||
|
||||
variable "volume_name" {
|
||||
type = string
|
||||
description = "Name of the final template image artifact."
|
||||
}
|
||||
|
||||
variable "volume_pool" {
|
||||
type = string
|
||||
description = "Host storage pool where the template image will be kept."
|
||||
}
|
||||
|
||||
variable "volume_capacity" {
|
||||
type = string
|
||||
description = "Size of the template image drive."
|
||||
}
|
||||
|
||||
variable "bridge_name" {
|
||||
type = string
|
||||
description = "Name of the bridge netdev on the host."
|
||||
}
|
||||
|
||||
variable "guest_ssh_user" {
|
||||
type = string
|
||||
description = "User account for connecing to the guest VM, eg for provisioners."
|
||||
}
|
||||
|
||||
variable "guest_ssh_pass" {
|
||||
type = string
|
||||
sensitive = true
|
||||
description = "Password for SSH connection to the guest VM."
|
||||
}
|
||||
|
||||
variable "guest_ssh_port" {
|
||||
type = number
|
||||
description = "SSH port for connecting to the guest VM."
|
||||
default = 22
|
||||
}
|
||||
|
||||
variable "guest_ssh_private_key" {
|
||||
type = string
|
||||
description = "File path to the private key used for SSH pubkey auth to the guest VM."
|
||||
}
|
||||
|
||||
variable "guest_ssh_public_key" {
|
||||
type = string
|
||||
description = "File path to the public key to be added to authoried_keys on the guest VM during cloud-init."
|
||||
}
|
||||
|
||||
variable "guest_hostname" {
|
||||
type = string
|
||||
description = "The hostname of the virtual machine"
|
||||
}
|
||||
|
||||
variable "ssh_source" {
|
||||
type = string
|
||||
description = "The subnet that will be added to the firewall SSH exception during cloud-init."
|
||||
}
|
||||
|
||||
variable "host_ssh_address" {
|
||||
type = string
|
||||
description = "The address of the hypervisor, used to construct the libvirt URI."
|
||||
@ -23,19 +129,22 @@ variable "host_ssh_user" {
|
||||
description = "The user to connect to the hypervisor as, used to construct the libvirt URI."
|
||||
}
|
||||
|
||||
variable "arch" {
|
||||
type = string
|
||||
description = "Domain architecture."
|
||||
default = "x86_64"
|
||||
}
|
||||
|
||||
variable "chipset" {
|
||||
variable "network_address" {
|
||||
type = string
|
||||
description = "Libvirt Machine Type Value for domain XML's machine type."
|
||||
description = "Network address assigned to the guest."
|
||||
}
|
||||
|
||||
variable "guest_ssh_pass" {
|
||||
type = string
|
||||
sensitive = true
|
||||
description = "Default password for the cloud-init image"
|
||||
variable "network_gateway" {
|
||||
type = string
|
||||
description = "Default gateway assigned to the guest."
|
||||
}
|
||||
|
||||
variable "network_nameserver" {
|
||||
type = string
|
||||
description = "DNS/Nameserver assigned to the guest."
|
||||
}
|
||||
|
||||
variable "network_domain" {
|
||||
type = string
|
||||
description = "Search domain assigned to the guest."
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user