Zack Williams | 5b5d9a7 | 2020-11-06 13:59:06 -0700 | [diff] [blame] | 1 | #_preseed_V1 |
| 2 | {# |
| 3 | SPDX-FileCopyrightText: © 2020 Open Networking Foundation <support@opennetworking.org> |
| 4 | SPDX-License-Identifier: Apache-2.0 |
| 5 | #} |
| 6 | # preseed docs: https://help.ubuntu.com/18.04/installation-guide/amd64/apbs04.html |
| 7 | |
| 8 | # enable automatic install |
| 9 | d-i auto-install/enable boolean true |
| 10 | |
| 11 | # ask only critical level questions |
| 12 | d-i debconf/priority select critical |
| 13 | |
| 14 | # locale and keyboard |
| 15 | d-i debian-installer/locale string en_US.UTF-8 |
| 16 | d-i console-setup/ask_detect boolean false |
| 17 | d-i keyboard-configuration/xkb-keymap select us |
| 18 | |
| 19 | # clock |
| 20 | d-i clock-setup/utc boolean true |
| 21 | d-i time/zone string Etc/UTC |
| 22 | d-i clock-setup/ntp boolean true |
| 23 | d-i clock-setup/ntp-server string ntp.ubuntu.com |
| 24 | |
| 25 | # network and hostname |
Zack Williams | 3fcd2c5 | 2021-03-02 21:44:52 -0700 | [diff] [blame] | 26 | {% if 'iface' in item %} |
| 27 | d-i netcfg/choose_interface select {{ item['iface'] }} |
| 28 | {% else %} |
Zack Williams | 5b5d9a7 | 2020-11-06 13:59:06 -0700 | [diff] [blame] | 29 | d-i netcfg/choose_interface select auto |
Zack Williams | 3fcd2c5 | 2021-03-02 21:44:52 -0700 | [diff] [blame] | 30 | {% endif %} |
Zack Williams | 5b5d9a7 | 2020-11-06 13:59:06 -0700 | [diff] [blame] | 31 | d-i netcfg/hostname string {{ item['hostname'] }} |
Zack Williams | db39414 | 2020-11-11 22:52:34 -0700 | [diff] [blame] | 32 | d-i netcfg/get_domain string {{ item['domain'] }} |
Zack Williams | 5b5d9a7 | 2020-11-06 13:59:06 -0700 | [diff] [blame] | 33 | d-i hw-detect/load_firmware boolean true |
| 34 | |
| 35 | ## Storage |
| 36 | # overwrite previous partitions |
| 37 | d-i partman-lvm/device_remove_lvm boolean true |
| 38 | d-i partman-lvm/confirm boolean true |
| 39 | d-i partman-lvm/confirm_nooverwrite boolean true |
| 40 | d-i partman-md/device_remove_md boolean true |
| 41 | d-i partman-md/confirm boolean true |
| 42 | |
| 43 | # use lvm |
| 44 | d-i partman-auto/method string lvm |
| 45 | d-i partman-auto/init_automatically_partition select biggest_free |
| 46 | d-i partman-auto-lvm/guided_size string max |
| 47 | d-i partman-auto-lvm/new_vg_name string primary |
| 48 | |
| 49 | # use gpt |
| 50 | d-i partman-basicfilesystems/choose_label string gpt |
| 51 | d-i partman-basicfilesystems/default_label string gpt |
| 52 | d-i partman-partitioning/choose_label string gpt |
| 53 | d-i partman-partitioning/default_label string gpt |
| 54 | d-i partman/choose_label string gpt |
| 55 | d-i partman/default_label string gpt |
| 56 | |
| 57 | # use ext4 |
| 58 | d-i partman/default_filesystem string ext4 |
| 59 | |
| 60 | # partitioning |
| 61 | d-i partman-auto/choose_recipe select atomic |
| 62 | d-i partman-partitioning/confirm_write_new_label boolean true |
| 63 | d-i partman/alignment select optimal |
| 64 | d-i partman/choose_partition select finish |
| 65 | d-i partman/confirm boolean true |
| 66 | d-i partman/confirm_nooverwrite boolean true |
| 67 | |
Zack Williams | db39414 | 2020-11-11 22:52:34 -0700 | [diff] [blame] | 68 | ### Do NOT install on the USB stick(!) |
| 69 | # |
| 70 | # The Debian installer will install on the first disk it finds which can |
| 71 | # sometimes be the USB stick itself. Work around this by rolling our own auto |
| 72 | # detect logic which disallows installing on USB devices. |
| 73 | # |
| 74 | # Also, fix issue with grub hang on install |
Zack Williams | 5b5d9a7 | 2020-11-06 13:59:06 -0700 | [diff] [blame] | 75 | # https://bugs.launchpad.net/ubuntu/+source/os-prober/+bug/1663645 |
| 76 | d-i partman/early_command string \ |
Zack Williams | db39414 | 2020-11-11 22:52:34 -0700 | [diff] [blame] | 77 | USBDEV_LIST="$(mktemp)"; \ |
| 78 | list-devices usb-partition | sed "s/\(.*\)./\1/" > "$USBDEV_LIST"; \ |
| 79 | BOOTDEV="$(list-devices disk | grep -vf "$USBDEV_LIST" | head -n 1)"; \ |
| 80 | debconf-set partman-auto/disk "$BOOTDEV"; \ |
| 81 | debconf-set grub-installer/bootdev "$BOOTDEV"; \ |
Zack Williams | 5b5d9a7 | 2020-11-06 13:59:06 -0700 | [diff] [blame] | 82 | while /bin/true; do sleep 0.01; rm -f /target/etc/grub.d/30_os-prober; done & |
| 83 | |
| 84 | d-i grub-installer/only_debian boolean true |
| 85 | |
| 86 | ## Software |
| 87 | # install mirror |
| 88 | d-i mirror/country string manual |
| 89 | d-i mirror/protocol select http |
| 90 | d-i mirror/http/hostname string us.archive.ubuntu.com |
| 91 | d-i mirror/http/directory string /ubuntu |
| 92 | d-i mirror/http/proxy string |
| 93 | |
| 94 | # Use the HWE kernel |
| 95 | d-i base-installer/kernel/image select linux-generic-hwe-18.04 |
| 96 | base-installer base-installer/kernel/image select linux-generic-hwe-18.04 |
| 97 | |
| 98 | # install openssh and python3 |
| 99 | d-i pkgsel/include string openssh-server python3 |
| 100 | |
| 101 | # don't install any predefined package groups |
| 102 | d-i tasksel/first multiselect none |
| 103 | |
| 104 | # upgrade all packages on install |
| 105 | d-i pkgsel/upgrade select full-upgrade |
| 106 | |
| 107 | # don't allow root login over SSH |
| 108 | openssh-server openssh-server/permit-root-login boolean true |
| 109 | openssh-server openssh-server/password-authentication boolean true |
| 110 | |
| 111 | # don't automatically install updates on running system |
| 112 | pkgsel pkgsel/update-policy select none |
| 113 | |
| 114 | # verbose boot, no splashscreen |
| 115 | d-i debian-installer/quiet boolean false |
| 116 | d-i debian-installer/splash boolean false |
| 117 | |
| 118 | ## Users |
| 119 | # disable root account |
| 120 | d-i passwd/root-login boolean false |
| 121 | d-i passwd/root-password-crypted password !! |
| 122 | |
| 123 | # create user |
| 124 | d-i passwd/username string onfadmin |
| 125 | d-i passwd/user-fullname string ONFAdmin |
| 126 | d-i passwd/user-password-crypted password {{ preseed_onfadmin_pw_crypt }} |
| 127 | |
| 128 | # add SSH pubkey key to user, secure SSHd |
| 129 | d-i preseed/late_command string \ |
| 130 | in-target mkdir -p --mode=0700 /home/onfadmin/.ssh ;\ |
| 131 | in-target sh -c 'echo "{{ preseed_onfadmin_ssh_pubkey }}" > /home/onfadmin/.ssh/authorized_keys';\ |
| 132 | in-target chmod 0600 /home/onfadmin/.ssh/authorized_keys;\ |
| 133 | in-target chown -R onfadmin:onfadmin /home/onfadmin/.ssh;\ |
| 134 | in-target sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin no/g' /etc/ssh/sshd_config;\ |
| 135 | in-target sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config; |
| 136 | |
| 137 | ## Reboot |
| 138 | d-i finish-install/reboot_in_progress note |