rocky-docker-lxc/, caddy-vm/, monitoring-vm/ (was missing entirely -
Grafana+Loki+Prometheus stack, refreshed and CA mount stripped same as
everything else), and automation/{ansible,automation-vm,iac}/ for the
three repos that live on the automation VM. Hawser is genuinely
deployed on all three of caddy-vm/monitoring-vm/automation-vm so it's
duplicated in each rather than picking one canonical home.
Old Ansible/ and "Infrastrucutre as Code/" content moved under
automation/ansible/old-playbooks and automation/iac/old-content as-is
for now - contents still need refreshing against the current repos and
a per-folder README, that's the next pass.
106 lines
2.4 KiB
HCL
106 lines
2.4 KiB
HCL
packer {
|
|
required_plugins {
|
|
qemu = {
|
|
version = ">=1.0.0"
|
|
source = "github.com/hashicorp/qemu"
|
|
}
|
|
}
|
|
}
|
|
|
|
variable "admin_username" {
|
|
type = string
|
|
}
|
|
|
|
variable "admin_password_hash" {
|
|
type = string
|
|
sensitive = true
|
|
}
|
|
|
|
variable "admin_ssh_key" {
|
|
type = string
|
|
}
|
|
|
|
variable "ansible_username" {
|
|
type = string
|
|
}
|
|
|
|
variable "ansible_ssh_key" {
|
|
type = string
|
|
}
|
|
|
|
variable "iso_url" {
|
|
type = string
|
|
default = "https://download.rockylinux.org/pub/rocky/10/isos/x86_64/Rocky-10-latest-x86_64-minimal.iso"
|
|
}
|
|
|
|
variable "iso_checksum" {
|
|
type = string
|
|
default = "sha256:de75c2f7cc566ea964017a1e94883913f066c4ebeb1d356964e398ed76cadd12"
|
|
}
|
|
|
|
source "qemu" "rocky10" {
|
|
iso_url = var.iso_url
|
|
iso_checksum = var.iso_checksum
|
|
output_directory = "output-rocky10"
|
|
shutdown_command = "shutdown -h now"
|
|
format = "qcow2"
|
|
disk_size = 20480
|
|
http_directory = "http"
|
|
communicator = "ssh"
|
|
ssh_username = "root"
|
|
ssh_password = "HaveATemporaryPasswordHere"
|
|
ssh_timeout = "20m"
|
|
boot_wait = "20s"
|
|
boot_command = [
|
|
"<up><wait>",
|
|
"e<wait>", # edit boot entry
|
|
"<down><down><end><wait>", # go to linux line end
|
|
" inst.ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ks.cfg",
|
|
" console=tty0 console=ttyS0,115200n8",
|
|
" ip=dhcp",
|
|
"<f10><wait>" # boot with edited entry
|
|
]
|
|
|
|
headless = true
|
|
qemu_binary = "/usr/bin/qemu-system-x86_64"
|
|
accelerator = "kvm"
|
|
cpus = 2
|
|
memory = 2048
|
|
|
|
qemuargs = [
|
|
["-serial", "file:serial.log"],
|
|
["-cpu", "host"],
|
|
["-display", "none"]
|
|
]
|
|
}
|
|
|
|
|
|
build {
|
|
sources = ["source.qemu.rocky10"]
|
|
|
|
provisioner "file" {
|
|
source = "scripts/setup-admin-user.sh"
|
|
destination = "/tmp/setup-admin-user.sh"
|
|
}
|
|
|
|
provisioner "file" {
|
|
source = "scripts/setup-ansible-user.sh"
|
|
destination = "/tmp/setup-ansible-user.sh"
|
|
}
|
|
|
|
# Run setup-admin-user.sh
|
|
provisioner "shell" {
|
|
inline = [
|
|
"chmod +x /tmp/setup-admin-user.sh",
|
|
"/tmp/setup-admin-user.sh \"${var.admin_username}\" \"${var.admin_password_hash}\" \"${var.admin_ssh_key}\""
|
|
]
|
|
}
|
|
|
|
provisioner "shell" {
|
|
inline = [
|
|
"chmod +x /tmp/setup-ansible-user.sh",
|
|
"/tmp/setup-ansible-user.sh \"${var.ansible_username}\" \"${var.ansible_ssh_key}\""
|
|
]
|
|
}
|
|
}
|