Files
pxe_server/templates/preseed-server-v2.cfg.j2
2025-09-14 14:22:00 -07:00

97 lines
4.4 KiB
Django/Jinja
Executable File

# Preseed file for automated Debian installation
# Locale settings
d-i debian-installer/locale string en_US.UTF-8
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/xkb-keymap select us
# Network configuration
d-i netcfg/disable_dhcp6 boolean true
d-i netcfg/dhcp6_timeout string 1
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string cosmos-base
d-i netcfg/get_domain string home.cosmos
# Mirror settings
d-i mirror/country string manual
d-i mirror/http/hostname string ftp.us.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
d-i mirror/codename string trixie
# Account setup
d-i passwd/root-password-crypted password {{ cosmos_root_password | password_hash('sha512') }}
d-i passwd/make-user boolean true
d-i passwd/user-fullname string Cosmos User
d-i passwd/username string cosmos
d-i passwd/user-password-crypted password {{ cosmos_password | password_hash('sha512') }}
# Clock and time zone setup
d-i clock-setup/utc boolean true
d-i time/zone string America/Los_Angeles
d-i clock-setup/ntp boolean true
# Partitioning - Regular working
# This does standard partitioning i.e. not LVM
# d-i partman-auto/method string regular
# Obviously this selects the disk
d-i partman-auto/disk select auto
# /dev/sda
# The atomic recipe creates a very simple partitioning scheme with just a single root partition and swap space.
d-i partman-auto/choose_recipe select atomic
# this top one is the magic one that made the prompt go away; huzzah
# This line tells the installer to finalize the partitioning setup.
# By selecting finish, you indicate that you have completed the partitioning and
# the installer should proceed to format the partitions and continue with the installation.
# It's part of the process to automate the steps without manual confirmation
d-i partman/choose_partition select finish
# This setting automatically confirms the partitioning changes,
# allowing the installer to proceed without asking for user confirmation.
# Setting this to true is important for fully automated installations,
# as it avoids stopping the installation process to ask if you want to write the changes to disk.
d-i partman/confirm boolean true
# This line automatically confirms overwriting existing partitions on the disk.
# By setting this to true, the installer will overwrite any existing data
# on the specified disk without prompting for user confirmation.
# This is useful for fully automated installations where you want to ensure that old data is removed.
d-i partman/confirm_nooverwrite boolean true
# Opt out of the popularity contest survey
popularity-contest popularity-contest/participate boolean false
# Package selection
tasksel tasksel/first multiselect standard, ssh-server
d-i pkgsel/include string openssh-server curl openvpn net-tools htop
d-i pkgsel/upgrade select none
d-i preseed/late_command string \
mkdir -p /target/root/.ssh; \
mkdir -p /target/root/.config/htop; \
mkdir -p /target/etc/openvpn/client; \
mkdir -p /target/opt/cosmos/init; \
in-target echo " * * * * * root /root/update_issue.sh" >> /etc/crontab; \
in-target curl -o /opt/cosmos/cosmos-init.tar -L http://{{ server_ip }}/cosmos-init.tar; \
in-target tar -xf /opt/cosmos/cosmos-init.tar -C /opt/cosmos; \
cp /target/opt/cosmos/init/jenkins_key.pub /target/root/.ssh/authorized_keys; \
cp /target/opt/cosmos/init/update_issue.sh /target/root/update_issue.sh; \
cp /target/opt/cosmos/init/update_issue.service /target/etc/systemd/system/update_issue.service; \
cp /target/opt/cosmos/init/.bashrc /target/root/.bashrc; \
cp /target/opt/cosmos/init/htoprc /target/root/.config/htop/htoprc; \
cp /target/opt/cosmos/init/stat.sh /target/root/stat.sh; \
cp /target/opt/cosmos/init/cosmos-client.ovpn /target/etc/openvpn/client/cosmos-client.conf; \
cp /target/opt/cosmos/init/00-update-issue.conf /target/etc/cron.d/update-issue; \
cp /target/opt/cosmos/init/00-root-allow.conf /target/etc/ssh/sshd_config.d/00-root-allow.conf; \
in-target chmod +x /root/update_issue.sh; \
in-target chmod +x /root/stat.sh; \
in-target systemctl enable update_issue.service; \
in-target systemctl enable openvpn-client@cosmos-client
# Grub installation
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean false
# Reboot after installation
d-i finish-install/reboot_in_progress note
# Shutdown after installation
d-i debian-installer/exit/poweroff boolean true