feat: rocky 9 updates
This commit is contained in:
@@ -13,9 +13,10 @@ vm_os_version = "9"
|
||||
|
||||
// Virtual Machine Guest Operating System Setting
|
||||
vm_os_type = "l26"
|
||||
vm_cloudinit = true
|
||||
|
||||
// Virtual Machine Hardware Settings
|
||||
vm_bios = "seabios"
|
||||
vm_bios = "ovmf"
|
||||
vm_cpu_count = 1
|
||||
vm_cpu_sockets = 1
|
||||
vm_cpu_type = "x86-64-v2-AES"
|
||||
|
||||
@@ -33,10 +33,32 @@ data "git-repository" "cwd" {}
|
||||
// Defines the local variables.
|
||||
|
||||
locals {
|
||||
|
||||
bios_boot_command = [
|
||||
"<up><wait>",
|
||||
"<tab><wait>",
|
||||
" text ${local.data_source_command}",
|
||||
"<enter><wait>"
|
||||
]
|
||||
|
||||
uefi_boot_command = [
|
||||
// This sends the "up arrow" key, typically used to navigate through boot menu options.
|
||||
"<up>",
|
||||
// This sends the "e" key. In the GRUB boot loader, this is used to edit the selected boot menu option.
|
||||
"e",
|
||||
// This sends two "down arrow" keys, followed by the "end" key, and then waits. This is used to navigate to a specific line in the boot menu option's configuration.
|
||||
"<down><down><end><wait>",
|
||||
// This types the string "text" followed by the value of the 'data_source_command' local variable.
|
||||
// This is used to modify the boot menu option's configuration to boot in text mode and specify the kickstart data source configured in the common variables.
|
||||
"text ${local.data_source_command}",
|
||||
// This sends the "enter" key, waits, turns on the left control key, sends the "x" key, and then turns off the left control key. This is used to save the changes and exit the boot menu option's configuration, and then continue the boot process.
|
||||
"<enter><wait><leftCtrlOn>x<leftCtrlOff>"
|
||||
]
|
||||
|
||||
build_by = "Built by: HashiCorp Packer ${packer.version}"
|
||||
build_date = formatdate("DD-MM-YYYY hh:mm ZZZ", "${timestamp()}" )
|
||||
build_version = data.git-repository.cwd.head
|
||||
build_description = "Version: ${local.build_version}\nBuilt on: ${local.build_date}\n${local.build_by}\nCloud-Init: ${var.vm_cloud_init_enable}"
|
||||
build_description = "Version: ${local.build_version}\nBuilt on: ${local.build_date}\n${local.build_by}\nCloud-Init: ${var.vm_cloudinit}"
|
||||
vm_disk_type = var.vm_disk_type == "virtio" ? "vda" : "sda"
|
||||
manifest_date = formatdate("YYYY-MM-DD hh:mm:ss", timestamp())
|
||||
manifest_path = "${path.cwd}/manifests/"
|
||||
@@ -50,6 +72,7 @@ locals {
|
||||
vm_os_language = var.vm_os_language
|
||||
vm_os_keyboard = var.vm_os_keyboard
|
||||
vm_os_timezone = var.vm_os_timezone
|
||||
vm_cloudinit = var.vm_cloudinit
|
||||
network = templatefile("${abspath(path.root)}/data/network.pkrtpl.hcl", {
|
||||
device = var.vm_bridge_interface
|
||||
ip = var.vm_ip_address
|
||||
@@ -72,6 +95,7 @@ locals {
|
||||
}
|
||||
data_source_command = var.common_data_source == "http" ? "inst.ks=http://{{.HTTPIP}}:{{.HTTPPort}}/ks.cfg" : "inst.ks=/cdrom/ks.cfg"
|
||||
vm_name = "${var.vm_os_family}-${var.vm_os_name}-${var.vm_os_version}"
|
||||
boot_command = var.vm_bios == "ovmf" ? local.uefi_boot_command : local.bios_boot_command
|
||||
vm_bios = var.vm_bios == "ovmf" ? var.vm_firmware_path : null
|
||||
}
|
||||
|
||||
@@ -136,12 +160,7 @@ source "proxmox-iso" "linux-rocky" {
|
||||
http_port_max = var.common_data_source == "http" ? var.common_http_port_max : null
|
||||
boot = var.vm_boot
|
||||
boot_wait = var.vm_boot_wait
|
||||
boot_command = [
|
||||
"<up><wait>",
|
||||
"<tab><wait>",
|
||||
" text ${local.data_source_command}",
|
||||
"<enter><wait>"
|
||||
]
|
||||
boot_command = local.boot_command
|
||||
|
||||
dynamic "additional_iso_files" {
|
||||
for_each = var.common_data_source == "disk" ? [1] : []
|
||||
@@ -156,8 +175,8 @@ source "proxmox-iso" "linux-rocky" {
|
||||
template_description = "${local.build_description}"
|
||||
|
||||
# VM Cloud Init Settings
|
||||
cloud_init = var.vm_cloud_init_enable
|
||||
cloud_init_storage_pool = var.vm_cloud_init_enable == true ? var.vm_storage_pool : null
|
||||
cloud_init = var.vm_cloudinit
|
||||
cloud_init_storage_pool = var.vm_cloudinit == true ? var.vm_storage_pool : null
|
||||
|
||||
}
|
||||
|
||||
@@ -167,17 +186,21 @@ build {
|
||||
|
||||
provisioner "ansible" {
|
||||
user = "${var.build_username}"
|
||||
playbook_file = "${path.cwd}/ansible/main.yml"
|
||||
galaxy_file = "${path.cwd}/ansible/linux-requirements.yml"
|
||||
galaxy_force_with_deps = true
|
||||
playbook_file = "${path.cwd}/ansible/linux-playbook.yml"
|
||||
roles_path = "${path.cwd}/ansible/roles"
|
||||
ansible_env_vars = [
|
||||
"ANSIBLE_CONFIG=${path.cwd}/ansible/ansible.cfg"
|
||||
"ANSIBLE_CONFIG=${path.cwd}/ansible/ansible.cfg",
|
||||
"ANSIBLE_PYTHON_INTERPRETER=/usr/libexec/platform-python"
|
||||
]
|
||||
extra_arguments = [
|
||||
"--extra-vars", "display_skipped_hosts=false",
|
||||
"--extra-vars", "BUILD_USERNAME=${var.build_username}",
|
||||
"--extra-vars", "BUILD_SECRET='${var.build_key}'",
|
||||
"--extra-vars", "ANSIBLE_USERNAME=${var.ansible_username}",
|
||||
"--extra-vars", "ANSIBLE_SECRET='${var.ansible_key}'",
|
||||
"--extra-vars", "build_username=${var.build_username}",
|
||||
"--extra-vars", "build_key='${var.build_key}'",
|
||||
"--extra-vars", "ansible_username=${var.ansible_username}",
|
||||
"--extra-vars", "ansible_key='${var.ansible_key}'",
|
||||
"--extra-vars", "enable_cloudinit='${var.vm_cloudinit}'",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -198,7 +221,7 @@ build {
|
||||
vm_os_type = "${var.vm_os_type}"
|
||||
vm_mem_size = "${var.vm_mem_size}"
|
||||
vm_network_card_model = "${var.vm_network_card_model}"
|
||||
vm_cloud_init_enable = "${var.vm_cloud_init_enable}"
|
||||
vm_cloud_init_enable = "${var.vm_cloudinit}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ variable "vm_vlan_tag" {
|
||||
|
||||
// Cloud-Init Settings
|
||||
|
||||
variable "vm_cloud_init_enable" {
|
||||
variable "vm_cloudinit" {
|
||||
type = bool
|
||||
description = "Enable or disable cloud-init drive in Proxmox. (e.g. false)"
|
||||
default = false
|
||||
|
||||
Reference in New Issue
Block a user