diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..98cc5dc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +packer_cache/ \ No newline at end of file diff --git a/build.json b/build.json new file mode 100644 index 0000000..9689eb1 --- /dev/null +++ b/build.json @@ -0,0 +1,64 @@ +{ + "variables": { + "memory": "4G", + "cpus": "2", + + "iso_url": "https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-9.8.0-amd64-netinst.iso", + "iso_checksum": "cc4a6bd50925c1c4af98049060e304494bc9da61eb5eb272c556d67608de14d4e6a4b8bc1c9412a0f810083912e228569f3771ffffa7174538f3e26f45a05245", + "iso_checksum_type": "sha512", + + "boot_wait": "3s", + "boot_key_interval": "10ms", + + "ssh_username": "unifi", + "ssh_password": "uuunifi", + "ssh_timeout": "60m", + + "machine_hostname": "unifi-controller", + "machine_domain": "lab.uncomfortably.online", + + "http_directory": "http/", + "preseed_file": "preseed.cfg" + }, + "builders": [ + { + "type": "qemu", + "accelerator": "kvm", + "qemuargs": [ + [ "-m", "{{ user `memory` }}" ], + [ "-smp", "cpus={{ user `cpus`}}"] + ], + + "iso_url": "{{user `iso_url`}}", + "iso_checksum": "{{user `iso_checksum`}}", + "iso_checksum_type": "{{user `iso_checksum_type`}}", + + "http_directory": "{{user `http_directory`}}", + + "boot_wait": "{{user `boot_wait`}}", + "boot_key_interval": "{{user `boot_key_interval`}}", + "boot_command": [ + "", + "install ", + "auto=true ", + "url=http://{{.HTTPIP}}:{{.HTTPPort}}/{{user `preseed_file`}} ", + + "hostname={{user `machine_hostname`}} ", + "domain={{user `machine_domain`}} ", + "interface=auto ", + + "passwd/user-fullname={{user `ssh_username`}} ", + "passwd/username={{user `ssh_username`}} ", + "passwd/user-password={{user `ssh_password`}} ", + "passwd/user-password-again={{user `ssh_password`}} ", + + "" + ], + + "communicator": "ssh", + "ssh_username": "{{user `ssh_username`}}", + "ssh_password": "{{user `ssh_password`}}", + "ssh_timeout": "{{user `ssh_timeout`}}" + } + ] +} \ No newline at end of file diff --git a/http/preseed.cfg b/http/preseed.cfg new file mode 100644 index 0000000..7a1e306 --- /dev/null +++ b/http/preseed.cfg @@ -0,0 +1,62 @@ +### Localization +# Preseeding only locale sets language, country and locale. +d-i debian-installer/locale string en_US + +# Keyboard selection. +d-i keyboard-configuration/xkb-keymap select us + +### Network configuration +# netcfg will choose an interface that has link if possible. This makes it +# skip displaying a list if there is more than one interface. +d-i netcfg/choose_interface select auto + +# Disable that annoying WEP key dialog. +d-i netcfg/wireless_wep string + +### Mirror settings +d-i mirror/country string manual +d-i mirror/http/hostname string http.us.debian.org +d-i mirror/http/directory string /debian +d-i mirror/http/proxy string + +### Account setup +# Skip creation of a root account (normal user account will be able to +# use sudo). +d-i passwd/root-login boolean false + +## Package setup +d-i hw-detect/load_firmware boolean false +d-i hw-detect/load_media boolean false +apt-cdrom-setup apt-setup/cdrom/set-first boolean false +tasksel tasksel/first multiselect print-server, ssh-server, standard +d-i pkgsel/include string sudo, unattended-upgrades +popularity-contest popularity-contest/participate boolean false + +### Clock and time zone setup +d-i clock-setup/utc boolean true +d-i time/zone string UTC +d-i clock-setup/ntp boolean true + +### Partitioning +d-i partman-auto/method string lvm +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-md/device_remove_md boolean true +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true +d-i partman-auto/choose_recipe select atomic +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + +# This makes partman automatically partition without confirmation. +d-i partman-md/confirm boolean true +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true + +### Boot loader installation +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean true +d-i finish-install/reboot_in_progress note