Compare commits
2 Commits
dcd80cd7a3
...
4b49404a0c
Author | SHA1 | Date | |
---|---|---|---|
4b49404a0c | |||
509b6af145 |
@ -4,8 +4,13 @@ HEADLESS ?= true
|
||||
|
||||
default: install
|
||||
|
||||
install:
|
||||
packer build -var 'headless=$(HEADLESS)' .
|
||||
install: base
|
||||
|
||||
base:
|
||||
PKR_VAR_headless="$(HEADLESS)" packer build x86_64-qemu-base.pkr.hcl
|
||||
|
||||
vagrant:
|
||||
PKR_VAR_headless="$(HEADLESS)" packer build x86_64-qemu-vagrant.pkr.hcl
|
||||
|
||||
clean:
|
||||
rm -rf ./builds
|
||||
|
@ -12,8 +12,8 @@ d-i apt-setup/cdrom/set-first boolean false
|
||||
# (Initial) root account setup
|
||||
d-i passwd/make-user boolean false
|
||||
d-i passwd/root-login boolean true
|
||||
d-i passwd/root-password password debian
|
||||
d-i passwd/root-password-again password debian
|
||||
# d-i passwd/root-password password debian
|
||||
# d-i passwd/root-password-again password debian
|
||||
|
||||
# Time
|
||||
d-i clock-setup/utc boolean true
|
||||
|
20
debian-13/scripts/vagrant.sh
Normal file
20
debian-13/scripts/vagrant.sh
Normal file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
set -eu
|
||||
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update
|
||||
apt-get install -y openssl curl sudo
|
||||
|
||||
useradd -m -p "$(openssl passwd -1 vagrant)" vagrant
|
||||
|
||||
echo "vagrant ALL=(ALL) NOPASSWD:ALL" >/etc/sudoers.d/vagrant
|
||||
chmod 440 /etc/sudoers.d/vagrant
|
||||
|
||||
install -d -m 0700 -o vagrant -g vagrant /home/vagrant/.ssh
|
||||
BASE_GH_URL="https://raw.githubusercontent.com/hashicorp/vagrant/refs/heads"
|
||||
curl -fsSL "${BASE_GH_URL}/main/keys/vagrant.pub" \
|
||||
-o /home/vagrant/.ssh/authorized_keys
|
||||
chmod 600 /home/vagrant/.ssh/authorized_keys
|
||||
|
||||
sed -i 's/PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config
|
||||
passwd -d root
|
@ -23,6 +23,10 @@ variable "memory" {
|
||||
default = 2048
|
||||
}
|
||||
|
||||
variable "ssh_password" {
|
||||
default = "debian"
|
||||
}
|
||||
|
||||
variable "headless" {
|
||||
default = true
|
||||
}
|
||||
@ -40,7 +44,7 @@ source "qemu" "debian-13-64-base" {
|
||||
accelerator = "kvm"
|
||||
http_directory = "http"
|
||||
ssh_username = "root"
|
||||
ssh_password = "debian"
|
||||
ssh_password = var.ssh_password
|
||||
ssh_timeout = "60m"
|
||||
vm_name = "debian-13-64-base"
|
||||
net_device = "virtio-net"
|
||||
@ -50,6 +54,8 @@ source "qemu" "debian-13-64-base" {
|
||||
"<tab>",
|
||||
" auto=true",
|
||||
" priority=critical",
|
||||
" passwd/root-password=${var.ssh_password}",
|
||||
" passwd/root-password-again=${var.ssh_password}",
|
||||
" hostname=trixie",
|
||||
" domain=",
|
||||
" url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg",
|
||||
|
56
debian-13/x86_64-qemu-vagrant.pkr.hcl
Normal file
56
debian-13/x86_64-qemu-vagrant.pkr.hcl
Normal file
@ -0,0 +1,56 @@
|
||||
packer {
|
||||
required_plugins {
|
||||
qemu = {
|
||||
version = ">= 1.1.3"
|
||||
source = "github.com/hashicorp/qemu"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
variable "memory" {
|
||||
default = 2048
|
||||
}
|
||||
|
||||
variable "ssh_password" {
|
||||
default = "debian"
|
||||
}
|
||||
|
||||
variable "headless" {
|
||||
default = true
|
||||
}
|
||||
|
||||
variable "disk_size" {
|
||||
default = 102400
|
||||
}
|
||||
|
||||
source "qemu" "debian-13-64-vagrant" {
|
||||
iso_url = "builds/qemu/debian-13-64-base/debian-13-64-base"
|
||||
disk_image = true
|
||||
iso_checksum = "none"
|
||||
output_directory = "builds/qemu/debian-13-64-vagrant"
|
||||
shutdown_command = "/usr/bin/systemctl poweroff"
|
||||
disk_interface = "virtio"
|
||||
disk_size = var.disk_size
|
||||
memory = var.memory
|
||||
headless = var.headless
|
||||
format = "qcow2"
|
||||
accelerator = "kvm"
|
||||
http_directory = "http"
|
||||
ssh_username = "root"
|
||||
ssh_password = var.ssh_password
|
||||
ssh_timeout = "60m"
|
||||
vm_name = "debian-13-64-base"
|
||||
net_device = "virtio-net"
|
||||
boot_wait = "5s"
|
||||
}
|
||||
|
||||
build {
|
||||
name = "debian-base"
|
||||
sources = ["source.qemu.debian-13-64-vagrant"]
|
||||
|
||||
provisioner "shell" {
|
||||
scripts = [
|
||||
"scripts/vagrant.sh"
|
||||
]
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user