Skip to content

Commit

Permalink
remove args and set simple values where args are unnecessary
Browse files Browse the repository at this point in the history
  • Loading branch information
ajanis committed May 17, 2024
1 parent 40d7217 commit 661f492
Showing 1 changed file with 52 additions and 33 deletions.
85 changes: 52 additions & 33 deletions cableos/cableos-installer.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ variable "customize_script" {

variable "headless" {
type = bool
default = true
default = false
description = "Whether VNC viewer should not be launched."
}

Expand Down Expand Up @@ -113,27 +113,46 @@ locals {
source "qemu" "cableos-installer" {
boot_wait = "2s"
cpus = 2
cpu_model = "${lookup(local.qemu_cpu, var.architecture, "")}"f
disk_image = true
disk_size = "15G"
disk_size = "10G"
use_backing_file = true
format = "qcow2"
headless = var.headless
http_directory = var.http_directory
iso_checksum = "md5:37f6ddeaf58b7dfa70bc3615047e4d09"
iso_url = "${path.root}/boot-images/${var.live_img}.qcow2"
memory = 2048
efi_boot = true
efi_firmware_code = "/usr/share/${lookup(local.uefi_imp, var.architecture, "")}/${lookup(local.uefi_imp, var.architecture, "")}_CODE.fd"
efi_firmware_vars = "${lookup(local.uefi_imp, var.architecture, "")}_VARS.fd"
qemu_binary = "qemu-system-${lookup(local.qemu_arch, var.architecture, "")}"
qemu_img_args {
create = ["-F", "qcow2"]
}
qemuargs = [
["-machine", "${lookup(local.qemu_machine, var.architecture, "")}"],
["-cpu", "${lookup(local.qemu_cpu, var.architecture, "")}"],
["-device", "virtio-gpu-pci"]
# ["-drive", "if=pflash,format=raw,id=ovmf_code,readonly=on,file=/usr/share/${lookup(local.uefi_imp, var.architecture, "")}/${lookup(local.uefi_imp, var.architecture, "")}_CODE.fd"],
# ["-drive", "if=pflash,format=raw,id=ovmf_vars,file=${lookup(local.uefi_imp, var.architecture, "")}_VARS.fd"]
# ["-drive", "file=output-cableos-installer/packer-cableos-installer-img,format=qcow2"]
# ["-drive", "file=${path.root}/buildfiles/${apollo_iso},if=none,id=cdrom0,media=cdrom"]
]
# qemu_img_args {
# create = ["-F", "qcow2"]
# }

# qemuargs = [
# ["-device", "virtio-gpu-pci"],
# ["-machine", "${lookup(local.qemu_machine, var.architecture, "")}"],
# ["-device", "virtio-blk-pci,drive=drive0,bootindex=0"],
# ["-device", "virtio-blk-pci,drive=cdrom0,bootindex=1"],
# ["-device", "virtio-blk-pci,drive=drive1,bootindex=2"],
# ["-drive", "if=pflash,format=raw,readonly=on,file=/usr/share/OVMF/OVMF_CODE.fd"],
# ["-drive", "if=pflash,format=raw,file=OVMF_VARS.fd"],
# ["-drive", "file=output-flat/packer-flat,if=none,id=drive0,cache=writeback,discard=ignore,format=raw"],
# ["-drive", "file=seeds-flat.iso,format=raw,cache=none,if=none,id=drive1,readonly=on"],
# ["-drive", "file=packer_cache/${var.ubuntu_series}.iso,if=none,id=cdrom0,media=cdrom"]
# ]
# qemuargs = [
# ["-machine", "${lookup(local.qemu_machine, var.architecture, "")}"],
# ["-cpu", "${lookup(local.qemu_cpu, var.architecture, "")}"],
# ["-device", "virtio-gpu-pci"],
# ["-device", "virtio-blk-pci,drive=cdrom0,bootindex=1"],
# # ["-drive", "if=pflash,format=raw,id=ovmf_code,readonly=on,file=/usr/share/${lookup(local.uefi_imp, var.architecture, "")}/${lookup(local.uefi_imp, var.architecture, "")}_CODE.fd"],
# # ["-drive", "if=pflash,format=raw,id=ovmf_vars,file=${lookup(local.uefi_imp, var.architecture, "")}_VARS.fd"]
# # ["-drive", "file=output-cableos-installer/packer-cableos-installer-img,format=qcow2"]
# # ["-drive", "file=${path.root}/buildfiles/${apollo_iso},if=none,id=cdrom0,media=cdrom"]
# ]
shutdown_command = "sudo -S shutdown -P now"
ssh_handshake_attempts = 50
ssh_password = var.ssh_password
Expand All @@ -159,30 +178,30 @@ build {
// Provisioners for installation and file extraction


# provisioner "shell" {
# inline = [
# "mkdir /data",
provisioner "shell" {
inline = [
"mkdir /data"
]
}
# "curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/APOLLO_PLATFORM-release-3.21.3.0-7+auto15.iso --output /data/APOLLO_PLATFORM-release-3.21.3.0-7+auto15.iso",
# "curl http://{{ .HTTPIP }}:{{ .HTTPPort }}/startup.sh --output /etc/init.d/startup.sh"
# ]
# }

# provisioner "file" {
# destination = "/data/"
# source = "${path.root}/buildfiles/${var.apollo_iso}"
# timeout = "10m"
# }
provisioner "file" {
destination = "/data/"
source = "${path.root}/buildfiles/${var.apollo_iso}"
# timeout = "10m"
}

# provisioner "file" {
# destination = "/etc/init.d/"
# source = "${path.root}/buildfiles/startup.sh"
# }
provisioner "file" {
destination = "/root/"
source = "${path.root}/buildfiles/cableos.sh"
}

# provisioner "shell-local" {
# inline = [
# "echo 'CableOS-Installer 1-Shot System-D service file copied to '"
# ]
# }
provisioner "shell-local" {
inline = [
"echo 'CableOS-Installer 1-Shot System-D service file copied to '"
]
}

// Post-processors to create new images and prepare for MAAS
// Create tar.gz file
Expand Down

0 comments on commit 661f492

Please sign in to comment.