diff options
Diffstat (limited to 'roles')
13 files changed, 202 insertions, 598 deletions
diff --git a/roles/cloud/install/templates/hetzner_installimage.conf.j2 b/roles/cloud/install/templates/hetzner_installimage.conf.j2 index 0881b110..ed22f286 100644 --- a/roles/cloud/install/templates/hetzner_installimage.conf.j2 +++ b/roles/cloud/install/templates/hetzner_installimage.conf.j2 @@ -1,15 +1,13 @@ HOSTNAME {{ host_name }}{% if host_domain %}.{{ host_domain }}{% endif %}{{ '' }} {% if cloud_provider == "hroot" %} -{% if install_cooked.disks.layout == "nvme_raid" %} -DRIVE1 /dev/nvme0n1 -DRIVE2 /dev/nvme1n1 +{% if install_cooked.disks.primary == "software-raid" %} +{% for raid_member in install_cooked.disks.raid.members %} +DRIVE{{ loop.index }} {{ raid_member }} +{% endfor %} SWRAID 1 -SWRAIDLEVEL 1 -{% elif install_cooked.disks.layout == "sata_raid" %} -DRIVE1 /dev/sda -DRIVE2 /dev/sdb -SWRAID 1 -SWRAIDLEVEL 1 +SWRAIDLEVEL {{ install_cooked.disks.raid.level }} +{% else %} +DRIVE1 {{ install_cooked.disks.primary }} {% endif %} {% elif cloud_provider == "hcloud" %} DRIVE1 /dev/sda diff --git a/roles/installer/debian/preseed/tasks/main.yml b/roles/installer/debian/preseed/tasks/main.yml index 373f0a41..2934ca1b 100644 --- a/roles/installer/debian/preseed/tasks/main.yml +++ b/roles/installer/debian/preseed/tasks/main.yml @@ -10,6 +10,12 @@ src: "preseed_{{ hostvars[install_hostname].preseed_template_name | default(install_distro + '-' + install_codename) }}.cfg.j2" dest: "{{ preseed_tmpdir }}/preseed.cfg" +- name: Generate partmam early-command script + template: + src: "partman_early-command.sh.j2" + dest: "{{ preseed_tmpdir }}/partman_early-command.sh" + mode: 0755 + - name: Generate authorized_keys file authorized_key: user: root @@ -41,6 +47,7 @@ chdir: "{{ preseed_tmpdir }}" stdin: | preseed.cfg + partman_early-command.sh authorized_keys etc/ etc/systemd/ diff --git a/roles/installer/debian/preseed/templates/partman_config.j2 b/roles/installer/debian/preseed/templates/partman_config.j2 new file mode 100644 index 00000000..ca6feb41 --- /dev/null +++ b/roles/installer/debian/preseed/templates/partman_config.j2 @@ -0,0 +1,129 @@ +{# https://unix.stackexchange.com/questions/510445/install-grub-bootloader-dynamically-to-multiple-disks #} +d-i partman/early_command string /partman_early-command.sh + +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true +d-i partman-md/device_remove_md boolean true +d-i partman-md/confirm boolean true +d-i partman-md/confirm_nooverwrite boolean true +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true + +d-i partman-auto/purge_lvm_from_device boolean true +d-i partman-auto-lvm/new_vg_name string {{ hostvars[install_hostname].host_name }} +d-i partman-auto-lvm/guided_size string max +d-i partman-auto-lvm/no_boot boolean true + +{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} +d-i partman-efi/non_efi_system boolean true +d-i partman/choose_label string gpt +d-i partman/default_label string gpt +d-i partman-partitioning/choose_label string gpt +d-i partman-partitioning/default_label string gpt +d-i partman-basicfilesystems/choose_label string gpt +d-i partman-basicfilesystems/default_label string gpt +{% else %} +d-i partman/choose_label string msdos +d-i partman/default_label string msdos +d-i partman-partitioning/choose_label string msdos +d-i partman-partitioning/default_label string msdos +d-i partman-basicfilesystems/choose_label string msdos +d-i partman-basicfilesystems/default_label string msdos +{% endif %} + + +{% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %} +d-i partman-auto/method string raid +{% else %} +d-i partman-auto/method string lvm +{% endif %} + +d-i partman-auto/expert_recipe string \ + ansible :: \ +{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} + 128 128 128 fat16 \ + $primary{ } $bootable{ } \ + method{ efi } format{ } \ + . \ +{% endif %} +{% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %} + 256 256 256 raid \ + $lvmignore{ } $primary{ } $bootable{ } \ + method{ raid } \ + . \ +{% if 'root_lvm_size' in hostvars[install_hostname].install_cooked.disks and hostvars[install_hostname].install_cooked.disks.root_lvm_size != 'all' %} +{% set root_lvm_size = ((hostvars[install_hostname].install_cooked.disks.root_lvm_size | human_to_bytes) / (1024*1024)) | int %} + {{ root_lvm_size }} {{ root_lvm_size }} {{ root_lvm_size }} raid \ + $lvmignore{ } $primary{ } \ + method{ raid } \ + . \ + 8 108 -1 ext4 \ + $lvmignore{ } $primary{ } \ + method{ unused } \ + . \ +{% else %} + 5120 5120 5120 raid \ + $lvmignore{ } $primary{ } \ + method{ raid } \ + . \ +{% endif %} +{% else %} +{% if 'root_lvm_size' in hostvars[install_hostname].install_cooked.disks and hostvars[install_hostname].install_cooked.disks.root_lvm_size != 'all' %} +{% set root_lvm_size = ((hostvars[install_hostname].install_cooked.disks.root_lvm_size | human_to_bytes) / (1024*1024)) | int %} + {{ root_lvm_size }} {{ root_lvm_size }} {{ root_lvm_size }} lvm \ + $defaultignore{ } $primary{ } \ + method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ + . \ + 8 108 -1 ext4 \ + $defaultignore{ } $primary{ } \ + method{ unused } \ + . \ +{% else %} + 5120 5120 5120 lvm \ + $defaultignore{ } $primary{ } \ + method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ + . \ +{% endif %} +{% endif %} + 2560 2560 2560 ext4 \ + $defaultignore{ } $lvmok{ } \ + in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 1280 1280 1280 ext4 \ + $defaultignore{ } $lvmok{ } \ + in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var } \ + . \ + 768 768 768 ext4 \ + $defaultignore{ } $lvmok{ } \ + in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /var/log } \ + options/nodev{ nodev } \ + options/noatime{ noatime } \ + options/noexec{ noexec } \ + . \ + 8 108 -1 ext4 \ + $defaultignore{ } $lvmok{ } \ + in_vg{ {{ hostvars[install_hostname].host_name }} } \ + lv_name{ dummy } \ + method{ unused } \ + . + + + +d-i partman-basicfilesystems/no_swap true +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish + + +## boot devices are configured by partman/early_command +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean true diff --git a/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 new file mode 100644 index 00000000..9c720e92 --- /dev/null +++ b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 @@ -0,0 +1,33 @@ +#!/bin/sh + +umount -l /media || true + + +{% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %} +disks="{% for disk in hostvars[install_hostname].install_cooked.disks.raid.members %}$(readlink -f {{ disk }}) {% endfor %}" + +raid_members_boot="" +raid_members_lvm="" +for disk in $disks; do + [ -n "$raid_members_boot" ] && raid_members_boot="$raid_members_boot#" + [ -n "$raid_members_lvm" ] && raid_members_lvm="$raid_members_lvm#" + if echo "$disk" | grep -Eq "/dev/(s|v)d[a-z]"; then + raid_members_boot="$raid_members_boot$disk"1 + raid_members_lvm="$raid_members_lvm$disk"2 + else + raid_members_boot="$raid_members_boot$disk"p1 + raid_members_lvm="$raid_members_lvm$disk"p2 + fi +done +raid_config="{{ hostvars[install_hostname].install_cooked.disks.raid.level }} {{ hostvars[install_hostname].install_cooked.disks.raid.members | length }} 0" + +debconf-set partman-auto-raid/recipe "$raid_config ext4 /boot $raid_members_boot . $raid_config lvm - $raid_members_lvm ." +{% else %} +disks="$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})" +{% endif %} +debconf-set partman-auto/disk "$disks" +debconf-set grub-installer/bootdev "$disks" + +## https://unix.stackexchange.com/questions/510445/install-grub-bootloader-dynamically-to-multiple-disks +. /usr/share/debconf/confmodule +db_fset grub-installer/bootdev seen true diff --git a/roles/installer/debian/preseed/templates/preseed_debian-buster-with-raid.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-buster-with-raid.cfg.j2 deleted file mode 100644 index 7907928a..00000000 --- a/roles/installer/debian/preseed/templates/preseed_debian-buster-with-raid.cfg.j2 +++ /dev/null @@ -1,151 +0,0 @@ -######################################################################### -# spreadspace preseed file for Debian buster based VMs -######################################################################### - -d-i debian-installer/language string en -d-i debian-installer/country string AT -d-i debian-installer/locale string en_US.UTF-8 -d-i keyboard-configuration/xkb-keymap select us - -d-i hw-detect/load_firmware boolean false - -d-i netcfg/choose_interface select {{ install_interface | default(hostvars[install_hostname].network_cooked.primary.name) }} -{% if 'install_dhcp' in hostvars[install_hostname] and hostvars[install_hostname].install_dhcp %} -d-i netcfg/disable_dhcp boolean false -d-i netcfg/disable_autoconfig boolean false -{% else %} -d-i netcfg/disable_dhcp boolean true -d-i netcfg/disable_autoconfig boolean true -d-i netcfg/get_ipaddress string {{ hostvars[install_hostname].network_cooked.primary.address | ipaddr('address') }} -d-i netcfg/get_netmask string {{ hostvars[install_hostname].network_cooked.primary.address | ipaddr('netmask') }} -d-i netcfg/get_gateway string {{ hostvars[install_hostname].network_cooked.primary.gateway }} -d-i netcfg/get_nameservers string {{ hostvars[install_hostname].network_cooked.nameservers | join(' ') }} -d-i netcfg/confirm_static boolean true -{% endif %} - -d-i netcfg/hostname string {{ hostvars[install_hostname].host_name }} -d-i netcfg/get_hostname string {{ hostvars[install_hostname].host_name }} -d-i netcfg/domain string {{ hostvars[install_hostname].network_cooked.domain }} -d-i netcfg/get_domain string {{ hostvars[install_hostname].network_cooked.domain }} -d-i netcfg/wireless_wep string - - -d-i mirror/country string manual -d-i mirror/http/hostname string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian }} -d-i mirror/http/directory string /debian -d-i mirror/http/proxy string - - -d-i passwd/make-user boolean false -d-i passwd/root-password password this-very-very-secure-password-will-be-removed-by-latecommand -d-i passwd/root-password-again password this-very-very-secure-password-will-be-removed-by-latecommand - - -d-i clock-setup/utc boolean true -d-i time/zone string Europe/Vienna -d-i clock-setup/ntp boolean false - -d-i partman-auto/disk string /dev/sda /dev/sdb - -d-i partman-auto/method string raid -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[install_hostname].host_name }} -d-i partman-auto-lvm/guided_size string max - -d-i partman-lvm/device_remove_lvm boolean true -d-i partman-md/device_remove_md boolean true -d-i partman-md/confirm boolean true -d-i partman-md/confirm_nooverwrite boolean true -d-i partman-lvm/confirm boolean true -d-i partman-lvm/confirm_nooverwrite boolean true - -d-i partman/choose_label string dos -d-i partman/default_label string dos -d-i partman-auto/choose_recipe select boot-root -d-i partman-auto/expert_recipe string \ - boot-root :: \ - 256 512 256 raid \ - $lvmignore{ } $primary{ } method{ raid } \ - . \ - 1000 10000 -1 raid \ - $lvmignore{ } $primary{ } method{ raid } \ - . \ - 15360 10000 20480 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 768 10000 768 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 20480 10000 20480 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /home } \ - . \ - 16 20000 -1 ext4 \ - $defaultignore{ } $lvmok{ } \ - in_vg{ {{ hostvars[install_hostname].host_name }} } \ - lv_name{ dummy } \ - . - -d-i partman-auto-raid/recipe string \ - 1 2 0 ext4 /boot \ - /dev/sda1#/dev/sdb1 \ - . \ - 1 2 0 lvm - \ - /dev/sda2#/dev/sdb2 \ - . - -d-i partman-basicfilesystems/no_swap 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 - - -d-i base-installer/install-recommends boolean false -d-i apt-setup/security_host string {{ apt_repo_providers[hostvars[install_hostname].apt_repo_provider].debian }} - -tasksel tasksel/first multiselect -d-i pkgsel/include string openssh-server python python-apt -d-i pkgsel/upgrade select safe-upgrade -popularity-contest popularity-contest/participate boolean false - -d-i grub-installer/choose_bootdev string /dev/sda /dev/sdb -d-i grub-installer/bootdev string /dev/sda /dev/sdb -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - -d-i finish-install/reboot_in_progress note - - -d-i preseed/late_command string \ - lvremove -f {{ hostvars[install_hostname].host_name }}/dummy; \ - in-target bash -c "apt-get update -q && apt-get full-upgrade -y -q"; \ - in-target bash -c "sed -e 's/^allow-hotplug/auto/' -i /etc/network/interfaces"; \ -{% if preseed_force_net_ifnames_policy is defined %} - mkdir -p /target/etc/systemd/network; \ - in-target bash -c "echo '[Match]' > /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "echo 'OriginalName=*' >> /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "echo '' >> /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "echo '[Link]' >> /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "echo 'NamePolicy={{ preseed_force_net_ifnames_policy }}' >> /etc/systemd/network/90-namepolicy.link"; \ - in-target bash -c "update-initramfs -u"; \ -{% endif %} - in-target bash -c "passwd -d root && passwd -l root"; \ -{% if hostvars[install_hostname].ansible_port is defined %} - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[install_hostname].ansible_port }}/' -i /etc/ssh/sshd_config"; \ -{% endif %} - mkdir -p -m 0700 /target/root/.ssh; \ - cp /authorized_keys /target/root/.ssh/ diff --git a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 index 770eb146..adad515e 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 @@ -46,73 +46,7 @@ d-i time/zone string Europe/Vienna d-i clock-setup/ntp boolean false -d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ - umount -l /media || true - -d-i grub-installer/choose_bootdev string manual -d-i grub-installer/bootdev seen true - -d-i partman-auto/method string lvm -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[install_hostname].host_name }} -d-i partman-auto-lvm/guided_size string max - -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 - -{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} -d-i partman-efi/non_efi_system boolean true -d-i partman/choose_label string gpt -d-i partman/default_label string gpt -{% endif %} -d-i partman-auto/expert_recipe string \ - boot-root :: \ -{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ -{% endif %} - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - lv_name{ dummy } \ - . - -d-i partman-auto-lvm/no_boot boolean true -d-i partman-basicfilesystems/no_swap 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 +{% include 'partman_config.j2' %} d-i base-installer/install-recommends boolean false @@ -123,9 +57,6 @@ d-i pkgsel/include string openssh-server python python-apt d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - d-i finish-install/reboot_in_progress note diff --git a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 index cf20410a..bd712a08 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 @@ -46,73 +46,7 @@ d-i time/zone string Europe/Vienna d-i clock-setup/ntp boolean false -d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ - umount -l /media || true - -d-i grub-installer/choose_bootdev string manual -d-i grub-installer/bootdev seen true - -d-i partman-auto/method string lvm -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[install_hostname].host_name }} -d-i partman-auto-lvm/guided_size string max - -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 - -{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} -d-i partman-efi/non_efi_system boolean true -d-i partman/choose_label string gpt -d-i partman/default_label string gpt -{% endif %} -d-i partman-auto/expert_recipe string \ - boot-root :: \ -{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ -{% endif %} - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - lv_name{ dummy } \ - . - -d-i partman-auto-lvm/no_boot boolean true -d-i partman-basicfilesystems/no_swap 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 +{% include 'partman_config.j2' %} d-i base-installer/install-recommends boolean false @@ -123,9 +57,6 @@ d-i pkgsel/include string openssh-server python python-apt d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - d-i finish-install/reboot_in_progress note diff --git a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 index 3528d682..487e4727 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 @@ -46,73 +46,7 @@ d-i time/zone string Europe/Vienna d-i clock-setup/ntp boolean false -d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ - umount -l /media || true - -d-i grub-installer/choose_bootdev string manual -d-i grub-installer/bootdev seen true - -d-i partman-auto/method string lvm -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[install_hostname].host_name }} -d-i partman-auto-lvm/guided_size string max - -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 - -{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} -d-i partman-efi/non_efi_system boolean true -d-i partman/choose_label string gpt -d-i partman/default_label string gpt -{% endif %} -d-i partman-auto/expert_recipe string \ - boot-root :: \ -{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ -{% endif %} - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - lv_name{ dummy } \ - . - -d-i partman-auto-lvm/no_boot boolean true -d-i partman-basicfilesystems/no_swap 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 +{% include 'partman_config.j2' %} d-i base-installer/install-recommends boolean false @@ -123,9 +57,6 @@ d-i pkgsel/include string openssh-server python python-apt d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - d-i finish-install/reboot_in_progress note diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 index 1b5245a1..b8562e2e 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 @@ -54,73 +54,7 @@ d-i time/zone string Europe/Vienna d-i clock-setup/ntp boolean false -d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ - umount -l /media || true - -d-i grub-installer/choose_bootdev string manual -d-i grub-installer/bootdev seen true - -d-i partman-auto/method string lvm -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[install_hostname].host_name }} -d-i partman-auto-lvm/guided_size string max - -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 - -{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} -d-i partman-efi/non_efi_system boolean true -d-i partman/choose_label string gpt -d-i partman/default_label string gpt -{% endif %} -d-i partman-auto/expert_recipe string \ - boot-root :: \ -{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ -{% endif %} - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - lv_name{ dummy } \ - . - -d-i partman-auto-lvm/no_boot boolean true -d-i partman-basicfilesystems/no_swap 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 +{% include 'partman_config.j2' %} d-i base-installer/install-recommends boolean false @@ -132,9 +66,6 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - d-i finish-install/reboot_in_progress note diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 index ca018fd2..d8208a5e 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 @@ -54,73 +54,7 @@ d-i time/zone string Europe/Vienna d-i clock-setup/ntp boolean false -d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ - umount -l /media || true - -d-i grub-installer/choose_bootdev string manual -d-i grub-installer/bootdev seen true - -d-i partman-auto/method string lvm -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[install_hostname].host_name }} -d-i partman-auto-lvm/guided_size string max - -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 - -{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} -d-i partman-efi/non_efi_system boolean true -d-i partman/choose_label string gpt -d-i partman/default_label string gpt -{% endif %} -d-i partman-auto/expert_recipe string \ - boot-root :: \ -{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ -{% endif %} - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - lv_name{ dummy } \ - . - -d-i partman-auto-lvm/no_boot boolean true -d-i partman-basicfilesystems/no_swap 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 +{% include 'partman_config.j2' %} d-i base-installer/install-recommends boolean false @@ -132,9 +66,6 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - d-i finish-install/reboot_in_progress note diff --git a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 index cdb5f966..0387027f 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 @@ -51,73 +51,7 @@ d-i time/zone string Europe/Vienna d-i clock-setup/ntp boolean false -d-i partman/early_command string \ - debconf-set partman-auto/disk "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ - debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ - umount -l /media || true - -d-i grub-installer/choose_bootdev string manual -d-i grub-installer/bootdev seen true - -d-i partman-auto/method string lvm -d-i partman-auto/purge_lvm_from_device boolean true -d-i partman-auto-lvm/new_vg_name string {{ hostvars[install_hostname].host_name }} -d-i partman-auto-lvm/guided_size string max - -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 - -{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} -d-i partman-efi/non_efi_system boolean true -d-i partman/choose_label string gpt -d-i partman/default_label string gpt -{% endif %} -d-i partman-auto/expert_recipe string \ - boot-root :: \ -{% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ efi } format{ } \ - . \ -{% endif %} - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } $bootable{ } \ - method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ - . \ - 2048 10000 2560 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 1024 11000 1280 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var } \ - . \ - 768 10000 768 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /var/log } \ - options/nodev{ nodev } options/noatime{ noatime } \ - options/noexec{ noexec } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - lv_name{ dummy } \ - . - -d-i partman-auto-lvm/no_boot boolean true -d-i partman-basicfilesystems/no_swap 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 +{% include 'partman_config.j2' %} d-i base-installer/install-recommends boolean false @@ -129,9 +63,6 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - d-i finish-install/reboot_in_progress note diff --git a/roles/installer/debian/preseed/templates/preseed_xubuntu-focal-desktop.cfg.j2 b/roles/installer/debian/preseed/templates/preseed_xubuntu-focal-desktop.cfg.j2 index aad183c7..eeda9943 100644 --- a/roles/installer/debian/preseed/templates/preseed_xubuntu-focal-desktop.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_xubuntu-focal-desktop.cfg.j2 @@ -62,19 +62,20 @@ d-i partman/early_command string \ debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[install_hostname].install_cooked.disks.primary }})"; \ umount -l /media || true -d-i grub-installer/choose_bootdev string manual -d-i grub-installer/bootdev seen true +d-i partman/confirm boolean true +d-i partman/confirm_nooverwrite boolean true +d-i partman-md/device_remove_md boolean true +d-i partman-md/confirm boolean true +d-i partman-md/confirm_nooverwrite boolean true +d-i partman-lvm/device_remove_lvm boolean true +d-i partman-lvm/confirm boolean true +d-i partman-lvm/confirm_nooverwrite boolean true d-i partman-auto/method string lvm d-i partman-auto/purge_lvm_from_device boolean true d-i partman-auto-lvm/new_vg_name string {{ hostvars[install_hostname].host_name }} d-i partman-auto-lvm/guided_size string max - -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-lvm/no_boot boolean true {% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} d-i partman-efi/non_efi_system boolean true @@ -118,12 +119,16 @@ d-i partman-auto/expert_recipe string lv_name{ dummy } \ . -d-i partman-auto-lvm/no_boot boolean true d-i partman-basicfilesystems/no_swap 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 devices are configured by partman/early_command +d-i grub-installer/bootdev seen true +d-i grub-installer/choose_bootdev seen true +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean false d-i base-installer/install-recommends boolean false @@ -135,9 +140,6 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none -d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false - d-i finish-install/reboot_in_progress note diff --git a/roles/vm/define/templates/libvirt-domain.xml.j2 b/roles/vm/define/templates/libvirt-domain.xml.j2 index af9fbf52..c4c9e52a 100644 --- a/roles/vm/define/templates/libvirt-domain.xml.j2 +++ b/roles/vm/define/templates/libvirt-domain.xml.j2 @@ -1,15 +1,15 @@ <domain type='kvm'> <name>{{ install_hostname }}</name> - <memory>{{ hostvars[install_hostname].install_cooked.vm.mem * 1024 }}</memory> - <currentMemory>{{ hostvars[install_hostname].install_cooked.vm.mem * 1024 }}</currentMemory> - <vcpu>{{ hostvars[install_hostname].install_cooked.vm.numcpu }}</vcpu> + <memory>{{ ((hostvars[install_hostname].install_cooked.vm.memory | human_to_bytes) / 1024) | int }}</memory> + <currentMemory>{{ ((hostvars[install_hostname].install_cooked.vm.memory | human_to_bytes) / 1024) | int }}</currentMemory> + <vcpu>{{ hostvars[install_hostname].install_cooked.vm.numcpus }}</vcpu> <os> <type arch='x86_64' machine='pc-0.12'>hvm</type> {% if vm_define_installer %} {% if install_distro == 'debian' or install_distro == 'ubuntu' %} <kernel>{{ installer_path }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}/linux</kernel> <initrd>{{ preseed_tmpdir }}/initrd.preseed.gz</initrd> - <cmdline>console=ttyS0,115200n8</cmdline> + <cmdline>console=ttyS0,115200n8 DEBCONF_DEBUG=5</cmdline> <boot dev='hd'/> {% elif install_distro == 'openbsd' %} <boot dev='cdrom'/> |