feat: complete zROC project recreation — all 61 files populated

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Justin
2026-04-12 17:12:19 -04:00
parent ec794996bb
commit 5a617fd550
17 changed files with 2265 additions and 34 deletions
+82 -2
View File
@@ -1,2 +1,82 @@
# TODO: Full content to be added
# This file is part of the zROC project recreation
#cloud-config
autoinstall:
version: 1
locale: en_US.UTF-8
keyboard:
layout: us
source:
id: ubuntu-server-minimal
storage:
layout:
name: direct
config:
- type: disk
id: disk0
match:
size: largest
ptable: gpt
wipe: superblock-recursive
preserve: false
grub_device: true
- type: partition
id: part-efi
device: disk0
size: 512M
flag: boot
number: 1
preserve: false
- type: format
id: fmt-efi
volume: part-efi
fstype: fat32
preserve: false
- type: partition
id: part-root
device: disk0
size: -1
number: 2
preserve: false
- type: format
id: fmt-root
volume: part-root
fstype: ext4
preserve: false
- type: mount
id: mnt-root
device: fmt-root
path: /
- type: mount
id: mnt-efi
device: fmt-efi
path: /boot/efi
identity:
hostname: zroc-appliance
username: zroc
password: "$6$rounds=4096$packer$xKDMK6dLB2.8PZnJnXGpYQ9o0CWbEe4s7T5JY3bVq1ZQ2RQ6y7dAjH4wqpVLBkHPHU/CuW7.8SsLQ6TYe1"
ssh:
install-server: true
allow-pw: true
packages:
- curl
- wget
- git
- vim
- htop
- net-tools
- open-vm-tools
- ca-certificates
- gnupg
- lsb-release
- unattended-upgrades
- apt-transport-https
late-commands:
- echo 'zroc ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/zroc-packer
- chmod 440 /target/etc/sudoers.d/zroc-packer
- echo 'net.ipv6.conf.all.disable_ipv6 = 1' >> /target/etc/sysctl.d/99-zroc.conf
+173 -2
View File
@@ -1,2 +1,173 @@
# TODO: Full content to be added
# This file is part of the zROC project recreation
packer {
required_version = ">= 1.10.0"
required_plugins {
vmware = {
source = "github.com/hashicorp/vmware"
version = "~> 1.0"
}
qemu = {
source = "github.com/hashicorp/qemu"
version = "~> 1.0"
}
}
}
variable "ubuntu_iso_url" {
type = string
default = "https://releases.ubuntu.com/26.04/ubuntu-26.04-live-server-amd64.iso"
}
variable "ubuntu_iso_checksum" {
type = string
default = "file:https://releases.ubuntu.com/26.04/SHA256SUMS"
}
variable "vm_name" {
type = string
default = "zroc-appliance"
}
variable "vm_version" {
type = string
default = "1.0.0"
}
variable "disk_size_mb" {
type = number
default = 102400
}
variable "memory_mb" {
type = number
default = 8192
}
variable "cpus" {
type = number
default = 4
}
variable "output_dir" {
type = string
default = "../output"
}
variable "headless" {
type = bool
default = true
}
source "vmware-iso" "ubuntu2604" {
vm_name = "${var.vm_name}-${var.vm_version}"
guest_os_type = "ubuntu-64"
headless = var.headless
iso_url = var.ubuntu_iso_url
iso_checksum = var.ubuntu_iso_checksum
disk_size = var.disk_size_mb
disk_adapter_type = "pvscsi"
memory = var.memory_mb
cpus = var.cpus
network_adapter_type = "vmxnet3"
network = "nat"
disk_type_id = 0
http_directory = "http"
http_port_min = 8100
http_port_max = 8199
boot_wait = "5s"
boot_command = [
"e<wait>",
"<down><down><down><end>",
" autoinstall ds=nocloud-net;seedfrom=http://{{.HTTPIP}}:{{.HTTPPort}}/",
"<f10><wait30s>",
]
ssh_username = "zroc"
ssh_password = "zroc-setup-temp"
ssh_timeout = "30m"
ssh_port = 22
shutdown_command = "echo 'zroc-setup-temp' | sudo -S shutdown -P now"
output_directory = "${var.output_dir}/vmware"
skip_export = false
format = "ovf"
vmx_data = {
"virtualHW.version" = "19"
"tools.syncTime" = "TRUE"
"annotation" = "zROC Appliance v${var.vm_version}"
"guestOS" = "ubuntu-64"
}
}
source "qemu" "ubuntu2604" {
vm_name = "${var.vm_name}-${var.vm_version}"
iso_url = var.ubuntu_iso_url
iso_checksum = var.ubuntu_iso_checksum
disk_size = "${var.disk_size_mb}M"
disk_interface = "virtio"
memory = var.memory_mb
cpus = var.cpus
accelerator = "kvm"
headless = true
http_directory = "http"
http_port_min = 8100
http_port_max = 8199
boot_wait = "5s"
boot_command = [
"e<wait>",
"<down><down><down><end>",
" autoinstall ds=nocloud-net;seedfrom=http://{{.HTTPIP}}:{{.HTTPPort}}/",
"<f10><wait60s>",
]
ssh_username = "zroc"
ssh_password = "zroc-setup-temp"
ssh_timeout = "45m"
shutdown_command = "echo 'zroc-setup-temp' | sudo -S shutdown -P now"
output_directory = "${var.output_dir}/qemu"
format = "qcow2"
}
build {
name = "zroc-appliance"
sources = ["source.vmware-iso.ubuntu2604"]
provisioner "shell" {
script = "../scripts/00-base.sh"
execute_command = "echo 'zroc-setup-temp' | sudo -S bash {{.Path}}"
expect_disconnect = true
}
provisioner "shell" {
script = "../scripts/01-docker.sh"
execute_command = "echo 'zroc-setup-temp' | sudo -S bash {{.Path}}"
pause_before = "15s"
}
provisioner "shell" {
script = "../scripts/02-zroc.sh"
execute_command = "echo 'zroc-setup-temp' | sudo -S bash {{.Path}}"
}
provisioner "shell" {
script = "../scripts/03-setup-wizard.sh"
execute_command = "echo 'zroc-setup-temp' | sudo -S bash {{.Path}}"
}
provisioner "shell" {
script = "../scripts/04-systemd-service.sh"
execute_command = "echo 'zroc-setup-temp' | sudo -S bash {{.Path}}"
}
provisioner "shell" {
script = "../scripts/05-cleanup.sh"
execute_command = "echo 'zroc-setup-temp' | sudo -S bash {{.Path}}"
}
post-processor "shell-local" {
only = ["vmware-iso.ubuntu2604"]
inline = [
"cd ${var.output_dir}/vmware",
"ovftool --compress=9 *.ovf ../${var.vm_name}-${var.vm_version}-ubuntu-26.04-amd64.ova",
"cd ..",
"sha256sum ${var.vm_name}-${var.vm_version}-ubuntu-26.04-amd64.ova > ${var.vm_name}-${var.vm_version}-ubuntu-26.04-amd64.ova.sha256",
"echo 'OVA packaged successfully'",
]
}
}