fix: preseed

This commit is contained in:
Prémel-Cabic Arnaud
2024-05-08 20:27:09 +02:00
parent 71d6b22b81
commit 63e56664bc
3 changed files with 79 additions and 196 deletions

View File

@@ -7,55 +7,6 @@ packer {
}
}
variable "bios_type" {
type = string
}
variable "boot_command" {
type = string
}
variable "boot_wait" {
type = string
}
variable "bridge_firewall" {
type = bool
default = false
}
variable "bridge_name" {
type = string
}
variable "cloud_init" {
type = bool
}
variable "iso_file" {
type = string
}
variable "iso_storage_pool" {
type = string
default = "local"
}
variable "machine_default_type" {
type = string
default = "pc"
}
variable "network_model" {
type = string
default = "virtio"
}
variable "os_type" {
type = string
default = "l26"
}
variable "proxmox_api_token_id" {
type = string
}
@@ -73,153 +24,78 @@ variable "proxmox_node" {
type = string
}
variable "qemu_agent_activation" {
type = bool
default = true
}
variable "scsi_controller_type" {
type = string
}
variable "ssh_timeout" {
type = string
}
variable "tags" {
type = string
}
variable "io_thread" {
type = bool
}
variable "cpu_type" {
type = string
default = "x86-64-v3"
}
variable "vm_info" {
type = string
}
variable "disk_discard" {
type = bool
default = true
}
variable "disk_format" {
type = string
default = "qcow2"
}
variable "disk_size" {
type = string
default = "16G"
}
variable "disk_type" {
type = string
default = "scsi"
}
variable "nb_core" {
type = number
default = 1
}
variable "nb_cpu" {
type = number
default = 1
}
variable "nb_ram" {
type = number
default = 1024
}
variable "ssh_username" {
type = string
}
variable "ssh_password" {
type = string
}
variable "ssh_handshake_attempts" {
type = number
}
variable "storage_pool" {
type = string
default = "local-zfs"
}
variable "vm_id" {
type = number
default = 99999
}
variable "vm_name" {
type = string
}
locals {
packer_timestamp = formatdate("YYYYMMDD-hhmm", timestamp())
storage_pool = "local-zfs"
vm_name = "pckr-deb12"
}
source "proxmox-iso" "debian12" {
bios = "${var.bios_type}"
boot_command = ["${var.boot_command}"]
boot_wait = "${var.boot_wait}"
cloud_init = "${var.cloud_init}"
cloud_init_storage_pool = "${var.storage_pool}"
bios = "ovmf"
boot_command = [
"<wait><wait><wait>c<wait><wait><wait>",
"linux /install.amd/vmlinuz ",
"auto=true ",
"url=https://git.cloud.arnaud-pc.fr/ministicraft/packer-ministack/raw/branch/master/autoinstall/preseed.cfg ",
"hostname=${local.vm_name} ",
"domain=arnaud-pc.local ",
"interface=auto ",
"vga=788 noprompt quiet --<enter>",
"initrd /install.amd/initrd.gz<enter>",
"boot<enter>"
]
boot_wait = "10s"
cloud_init = true
cloud_init_storage_pool = local.storage_pool
communicator = "ssh"
cores = "${var.nb_core}"
cpu_type = "${var.cpu_type}"
http_directory = "autoinstall"
cores = 1
cpu_type = "x86-64-v3"
insecure_skip_tls_verify = true
iso_file = "${var.iso_file}"
machine = "${var.machine_default_type}"
memory = "${var.nb_ram}"
node = "${var.proxmox_node}"
os = "${var.os_type}"
iso_checksum = "sha512:33c08e56c83d13007e4a5511b9bf2c4926c4aa12fd5dd56d493c0653aecbab380988c5bf1671dbaea75c582827797d98c4a611f7fb2b131fbde2c677d5258ec9"
iso_url = "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-12.5.0-amd64-netinst.iso"
iso_storage_pool = "local"
iso_download_pve = true
machine = "q35"
memory = 2048
node = "pve3"
os = "l26"
proxmox_url = "${var.proxmox_api_url}"
qemu_agent = "${var.qemu_agent_activation}"
scsi_controller = "${var.scsi_controller_type}"
sockets = "${var.nb_cpu}"
ssh_handshake_attempts = "${var.ssh_handshake_attempts}"
qemu_agent = true
scsi_controller = "virtio-scsi-pci"
sockets = 1
ssh_handshake_attempts = 6
ssh_pty = true
ssh_timeout = "${var.ssh_timeout}"
ssh_username = "${var.ssh_username}"
ssh_password = "${var.ssh_password}"
tags = "${var.tags}"
template_description = "${var.vm_info} - ${local.packer_timestamp}"
ssh_timeout = "10m"
ssh_username = "debian"
ssh_private_key_file = "/home/ministicraft/.ssh/id_ed25519"
tags = "debian-12;template"
template_description = "Debian 12 Packer Template - ${local.packer_timestamp}"
token = "${var.proxmox_api_token_secret}"
unmount_iso = true
username = "${var.proxmox_api_token_id}"
vm_id = "${var.vm_id}"
vm_name = "${var.vm_name}"
vm_id = 99998
vm_name = local.vm_name
efi_config {
efi_storage_pool = "${var.storage_pool}"
efi_storage_pool = "${local.storage_pool}"
pre_enrolled_keys = false
efi_type = "4m"
}
disks {
discard = "${var.disk_discard}"
disk_size = "${var.disk_size}"
format = "${var.disk_format}"
io_thread = "${var.io_thread}"
storage_pool = "${var.storage_pool}"
type = "${var.disk_type}"
discard = true
disk_size = "12G"
format = "raw"
io_thread = false
storage_pool = "${local.storage_pool}"
type = "scsi"
}
network_adapters {
bridge = "${var.bridge_name}"
firewall = "${var.bridge_firewall}"
model = "${var.network_model}"
bridge = "vmbr0"
firewall = false
model = "virtio"
}
}