From b02c21dc6967424bd180b6f7253c38f7778b4ee7 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 26 Jun 2020 20:01:26 +0200 Subject: debian/buster preseed cleanup --- .../preseed/templates/preseed_debian-buster.cfg.j2 | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'roles/installer/debian/preseed') 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..2a12ba20 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 @@ -51,19 +51,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 @@ -107,12 +108,9 @@ 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 d-i base-installer/install-recommends boolean false @@ -123,6 +121,10 @@ d-i pkgsel/include string openssh-server python python-apt d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false + +## grub-installer/bootdev is set by early_command +d-i grub-installer/bootdev seen true +d-i grub-installer/choose_bootdev string manual d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean false -- cgit v1.2.3 From 94e2ad7b7eba555950ec8c9086542bce4fa54e19 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 26 Jun 2020 22:48:21 +0200 Subject: more preseed file cleanups --- .../preseed_debian-buster-with-raid.cfg.j2 | 16 +++++++-------- .../preseed/templates/preseed_debian-jessie.cfg.j2 | 24 ++++++++++++---------- .../templates/preseed_debian-stretch.cfg.j2 | 24 ++++++++++++---------- .../preseed/templates/preseed_ubuntu-bionic.cfg.j2 | 24 ++++++++++++---------- .../preseed/templates/preseed_ubuntu-focal.cfg.j2 | 24 ++++++++++++---------- .../preseed/templates/preseed_ubuntu-xenial.cfg.j2 | 24 ++++++++++++---------- .../templates/preseed_xubuntu-focal-desktop.cfg.j2 | 24 ++++++++++++---------- 7 files changed, 86 insertions(+), 74 deletions(-) (limited to 'roles/installer/debian/preseed') 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 index 7907928a..7b7cfd27 100644 --- 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 @@ -47,18 +47,20 @@ 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/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 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/choose_label string dos d-i partman/default_label string dos d-i partman-auto/choose_recipe select boot-root @@ -110,8 +112,6 @@ d-i partman-auto-raid/recipe string \ 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 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..4bf945cc 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 @@ -51,19 +51,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 @@ -107,12 +108,9 @@ 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 d-i base-installer/install-recommends boolean false @@ -123,6 +121,10 @@ d-i pkgsel/include string openssh-server python python-apt d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false + +## grub-installer/bootdev is set by early_command +d-i grub-installer/bootdev seen true +d-i grub-installer/choose_bootdev string manual d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean false 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..32e7467a 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 @@ -51,19 +51,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 @@ -107,12 +108,9 @@ 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 d-i base-installer/install-recommends boolean false @@ -123,6 +121,10 @@ d-i pkgsel/include string openssh-server python python-apt d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false + +## grub-installer/bootdev is set by early_command +d-i grub-installer/bootdev seen true +d-i grub-installer/choose_bootdev string manual d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean false 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..0c6e9339 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 @@ -59,19 +59,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 @@ -115,12 +116,9 @@ 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 d-i base-installer/install-recommends boolean false @@ -132,6 +130,10 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none + +## grub-installer/bootdev is set by early_command +d-i grub-installer/bootdev seen true +d-i grub-installer/choose_bootdev string manual d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean false 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..c2d2324f 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 @@ -59,19 +59,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 @@ -115,12 +116,9 @@ 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 d-i base-installer/install-recommends boolean false @@ -132,6 +130,10 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none + +## grub-installer/bootdev is set by early_command +d-i grub-installer/bootdev seen true +d-i grub-installer/choose_bootdev string manual d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean false 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..889f33d9 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 @@ -56,19 +56,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 @@ -112,12 +113,9 @@ 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 d-i base-installer/install-recommends boolean false @@ -129,6 +127,10 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none + +## grub-installer/bootdev is set by early_command +d-i grub-installer/bootdev seen true +d-i grub-installer/choose_bootdev string manual d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean false 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..dd066085 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,9 @@ 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 d-i base-installer/install-recommends boolean false @@ -135,6 +133,10 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none + +## grub-installer/bootdev is set by early_command +d-i grub-installer/bootdev seen true +d-i grub-installer/choose_bootdev string manual d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean false -- cgit v1.2.3 From e840601bdedd5c96f4f77d5a209b663ce8d81ce4 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 28 Jun 2020 11:44:12 +0200 Subject: preseed: move partman config to common template --- .../debian/preseed/templates/partman_config.j2 | 65 +++++++++++++++++++++ .../preseed/templates/preseed_debian-buster.cfg.j2 | 66 +--------------------- .../preseed/templates/preseed_debian-jessie.cfg.j2 | 66 +--------------------- .../templates/preseed_debian-stretch.cfg.j2 | 66 +--------------------- .../preseed/templates/preseed_ubuntu-bionic.cfg.j2 | 66 +--------------------- .../preseed/templates/preseed_ubuntu-focal.cfg.j2 | 66 +--------------------- .../preseed/templates/preseed_ubuntu-xenial.cfg.j2 | 66 +--------------------- 7 files changed, 71 insertions(+), 390 deletions(-) create mode 100644 roles/installer/debian/preseed/templates/partman_config.j2 (limited to 'roles/installer/debian/preseed') 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..27dff5e2 --- /dev/null +++ b/roles/installer/debian/preseed/templates/partman_config.j2 @@ -0,0 +1,65 @@ +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 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-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 +{% 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-basicfilesystems/no_swap true +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish 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 2a12ba20..965f3ff5 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 @@ -46,71 +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 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-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 -{% 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-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish +{% include 'partman_config.j2' %} d-i base-installer/install-recommends boolean false 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 4bf945cc..2ef63b9e 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 @@ -46,71 +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 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-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 -{% 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-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish +{% include 'partman_config.j2' %} d-i base-installer/install-recommends boolean false 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 32e7467a..e751735c 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 @@ -46,71 +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 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-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 -{% 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-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish +{% include 'partman_config.j2' %} d-i base-installer/install-recommends boolean false 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 0c6e9339..41d38ff8 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 @@ -54,71 +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 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-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 -{% 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-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish +{% include 'partman_config.j2' %} d-i base-installer/install-recommends boolean false 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 c2d2324f..f65b3145 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 @@ -54,71 +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 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-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 -{% 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-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish +{% include 'partman_config.j2' %} d-i base-installer/install-recommends boolean false 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 889f33d9..6990cc55 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 @@ -51,71 +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 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-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 -{% 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-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish +{% include 'partman_config.j2' %} d-i base-installer/install-recommends boolean false -- cgit v1.2.3 From 6ab537c997cf1bee0071f2d2c823793717444cfe Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 28 Jun 2020 13:39:15 +0200 Subject: extract parman config from all pressed files --- .../preseed/templates/partman_raid_config.j2 | 68 ++++++++++++++++++++ .../debian/preseed/templates/partman_ws_config.j2 | 65 +++++++++++++++++++ .../preseed_debian-buster-with-raid.cfg.j2 | 75 ++-------------------- .../preseed/templates/preseed_debian-buster.cfg.j2 | 2 +- .../preseed/templates/preseed_debian-jessie.cfg.j2 | 2 +- .../templates/preseed_debian-stretch.cfg.j2 | 2 +- .../preseed/templates/preseed_ubuntu-bionic.cfg.j2 | 2 +- .../preseed/templates/preseed_ubuntu-focal.cfg.j2 | 2 +- .../preseed/templates/preseed_ubuntu-xenial.cfg.j2 | 2 +- .../templates/preseed_xubuntu-focal-desktop.cfg.j2 | 68 +------------------- 10 files changed, 147 insertions(+), 141 deletions(-) create mode 100644 roles/installer/debian/preseed/templates/partman_raid_config.j2 create mode 100644 roles/installer/debian/preseed/templates/partman_ws_config.j2 (limited to 'roles/installer/debian/preseed') diff --git a/roles/installer/debian/preseed/templates/partman_raid_config.j2 b/roles/installer/debian/preseed/templates/partman_raid_config.j2 new file mode 100644 index 00000000..866b3b9f --- /dev/null +++ b/roles/installer/debian/preseed/templates/partman_raid_config.j2 @@ -0,0 +1,68 @@ +d-i partman-auto/disk string /dev/sda /dev/sdb +d-i grub-installer/bootdev string /dev/sda /dev/sdb + +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 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/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 diff --git a/roles/installer/debian/preseed/templates/partman_ws_config.j2 b/roles/installer/debian/preseed/templates/partman_ws_config.j2 new file mode 100644 index 00000000..88b3f1ec --- /dev/null +++ b/roles/installer/debian/preseed/templates/partman_ws_config.j2 @@ -0,0 +1,65 @@ +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 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-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 +{% 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 }} } \ + . \ + 15360 10000 20480 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 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 } \ + . \ + 20480 10000 40960 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /home } \ + . \ + 16 20000 -1 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + lv_name{ dummy } \ + . + +d-i partman-basicfilesystems/no_swap true +d-i partman-partitioning/confirm_write_new_label boolean true +d-i partman/choose_partition select finish 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 index 7b7cfd27..17419ce3 100644 --- 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 @@ -45,73 +45,8 @@ 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/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 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/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 + +{% include 'partman_raid_config.j2' %} d-i base-installer/install-recommends boolean false @@ -122,8 +57,10 @@ 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 + +## grub-installer/bootdev is set by partman/early_command +d-i grub-installer/bootdev seen true +d-i grub-installer/choose_bootdev string manual d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean false 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 965f3ff5..8b740eef 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 @@ -58,7 +58,7 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false -## grub-installer/bootdev is set by early_command +## grub-installer/bootdev is set by partman/early_command d-i grub-installer/bootdev seen true d-i grub-installer/choose_bootdev string manual d-i grub-installer/only_debian boolean true 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 2ef63b9e..590914a7 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 @@ -58,7 +58,7 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false -## grub-installer/bootdev is set by early_command +## grub-installer/bootdev is set by partman/early_command d-i grub-installer/bootdev seen true d-i grub-installer/choose_bootdev string manual d-i grub-installer/only_debian boolean true 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 e751735c..02902b77 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 @@ -58,7 +58,7 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false -## grub-installer/bootdev is set by early_command +## grub-installer/bootdev is set by partman/early_command d-i grub-installer/bootdev seen true d-i grub-installer/choose_bootdev string manual d-i grub-installer/only_debian boolean true 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 41d38ff8..e80d38ae 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 @@ -67,7 +67,7 @@ popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none -## grub-installer/bootdev is set by early_command +## grub-installer/bootdev is set by partman/early_command d-i grub-installer/bootdev seen true d-i grub-installer/choose_bootdev string manual d-i grub-installer/only_debian boolean true 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 f65b3145..8442cd31 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 @@ -67,7 +67,7 @@ popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none -## grub-installer/bootdev is set by early_command +## grub-installer/bootdev is set by partman/early_command d-i grub-installer/bootdev seen true d-i grub-installer/choose_bootdev string manual d-i grub-installer/only_debian boolean true 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 6990cc55..d4ca1b30 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 @@ -64,7 +64,7 @@ popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none -## grub-installer/bootdev is set by early_command +## grub-installer/bootdev is set by partman/early_command d-i grub-installer/bootdev seen true d-i grub-installer/choose_bootdev string manual d-i grub-installer/only_debian boolean true 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 dd066085..d3295872 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 @@ -57,71 +57,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 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-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 -{% 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 }} } \ - . \ - 15360 10000 20480 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 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 } \ - . \ - 20480 10000 40960 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /home } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - lv_name{ dummy } \ - . - -d-i partman-basicfilesystems/no_swap true -d-i partman-partitioning/confirm_write_new_label boolean true -d-i partman/choose_partition select finish +{% include 'partman_ws_config.j2' %} d-i base-installer/install-recommends boolean false @@ -134,7 +70,7 @@ popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none -## grub-installer/bootdev is set by early_command +## grub-installer/bootdev is set by partman/early_command d-i grub-installer/bootdev seen true d-i grub-installer/choose_bootdev string manual d-i grub-installer/only_debian boolean true -- cgit v1.2.3 From 21b68833f431ca3569a5cbc41564bef2f2f32761 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 28 Jun 2020 22:45:16 +0200 Subject: another attempt to fix the partman recipe --- roles/installer/debian/preseed/tasks/main.yml | 7 ++ .../debian/preseed/templates/partman_config.j2 | 50 +++++++++--- .../preseed/templates/partman_early-command.sh.j2 | 34 +++++++++ .../preseed/templates/partman_raid_config.j2 | 68 ----------------- .../debian/preseed/templates/partman_ws_config.j2 | 7 ++ .../preseed_debian-buster-with-raid.cfg.j2 | 88 ---------------------- .../preseed/templates/preseed_debian-buster.cfg.j2 | 7 -- .../preseed/templates/preseed_debian-jessie.cfg.j2 | 7 -- .../templates/preseed_debian-stretch.cfg.j2 | 7 -- .../preseed/templates/preseed_ubuntu-bionic.cfg.j2 | 7 -- .../preseed/templates/preseed_ubuntu-focal.cfg.j2 | 7 -- .../preseed/templates/preseed_ubuntu-xenial.cfg.j2 | 7 -- .../templates/preseed_xubuntu-focal-desktop.cfg.j2 | 7 -- 13 files changed, 86 insertions(+), 217 deletions(-) create mode 100644 roles/installer/debian/preseed/templates/partman_early-command.sh.j2 delete mode 100644 roles/installer/debian/preseed/templates/partman_raid_config.j2 delete mode 100644 roles/installer/debian/preseed/templates/preseed_debian-buster-with-raid.cfg.j2 (limited to 'roles/installer/debian/preseed') diff --git a/roles/installer/debian/preseed/tasks/main.yml b/roles/installer/debian/preseed/tasks/main.yml index 46d6a1d9..53e9d225 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 partman early-command + 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 index 27dff5e2..ebaf180e 100644 --- a/roles/installer/debian/preseed/templates/partman_config.j2 +++ b/roles/installer/debian/preseed/templates/partman_config.j2 @@ -1,7 +1,4 @@ -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 partman/early_command string /partman_early-command.sh d-i partman/confirm boolean true d-i partman/confirm_nooverwrite boolean true @@ -12,7 +9,11 @@ d-i partman-lvm/device_remove_lvm boolean true d-i partman-lvm/confirm boolean true d-i partman-lvm/confirm_nooverwrite boolean true +{% 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/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 @@ -22,44 +23,69 @@ d-i partman-auto-lvm/no_boot boolean true d-i partman-efi/non_efi_system boolean true d-i partman/choose_label string gpt d-i partman/default_label string gpt +{% else %} +d-i partman/choose_label string dos +d-i partman/default_label string dos {% endif %} + +d-i partman-auto/choose_recipe select ansible d-i partman-auto/expert_recipe string \ - boot-root :: \ + ansible :: \ {% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} 100 100 128 fat16 \ $defaultignore{ } $primary{ } $bootable{ } \ method{ efi } format{ } \ . \ +{% endif %} +{% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %} + 256 10000 256 raid \ + $lvmignore{ } $primary{ } method{ raid } \ + . \ + 1000 10000 -1 raid \ + $lvmignore{ } $primary{ } method{ raid } \ + . \ {% 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 }} } \ + 2560 10000 2560 ext4 \ + $defaultignore{ } $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 }} } \ + 1280 10000 1280 ext4 \ + $defaultignore{ } $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 }} } \ + $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/nodev{ nodev } \ + options/noatime{ noatime } \ options/noexec{ noexec } \ . \ 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + $defaultignore{ } $lvmok{ } \ + in_vg{ {{ hostvars[install_hostname].host_name }} } \ lv_name{ dummy } \ . + 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/bootdev seen true +d-i grub-installer/only_debian boolean true +d-i grub-installer/with_other_os boolean false 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..08d3806d --- /dev/null +++ b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 @@ -0,0 +1,34 @@ +#!/bin/sh + +umount -l /media || true + + +{% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %} +raid_disks="$(readlink -f {{ install_cooked.disks.raid.members | join(' ') }} | xargs)" +raid_config="{{ install_cooked.disks.raid.level }} {{ install_cooked.disks.raid.members | length }} 0" + +raid_members_boot="" +raid_members_lvm="" +for disk in $raid_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"1 + else + raid_members_boot="$raid_members_boot$disk"p1 + raid_members_lvm="$raid_members_lvm$disk"p1 + fi +done + +debconf-set partman-auto-raid/recipe "$raid_config ext4 /boot $raid_members_boot . $raid_config lvm - $raid_members_lvm ." +debconf-set partman-auto/disk "$raid_disks" +debconf-set grub-installer/bootdev "$raid_disks" +{% else %} +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 }})" +{% endif %} + +## 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/partman_raid_config.j2 b/roles/installer/debian/preseed/templates/partman_raid_config.j2 deleted file mode 100644 index 866b3b9f..00000000 --- a/roles/installer/debian/preseed/templates/partman_raid_config.j2 +++ /dev/null @@ -1,68 +0,0 @@ -d-i partman-auto/disk string /dev/sda /dev/sdb -d-i grub-installer/bootdev string /dev/sda /dev/sdb - -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 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/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 diff --git a/roles/installer/debian/preseed/templates/partman_ws_config.j2 b/roles/installer/debian/preseed/templates/partman_ws_config.j2 index 88b3f1ec..54fe94f1 100644 --- a/roles/installer/debian/preseed/templates/partman_ws_config.j2 +++ b/roles/installer/debian/preseed/templates/partman_ws_config.j2 @@ -63,3 +63,10 @@ d-i partman-auto/expert_recipe string 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/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 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 17419ce3..00000000 --- a/roles/installer/debian/preseed/templates/preseed_debian-buster-with-raid.cfg.j2 +++ /dev/null @@ -1,88 +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 - - -{% include 'partman_raid_config.j2' %} - - -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 - - -## grub-installer/bootdev is set by partman/early_command -d-i grub-installer/bootdev seen true -d-i grub-installer/choose_bootdev string manual -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 8b740eef..adad515e 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-buster.cfg.j2 @@ -57,13 +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 - -## grub-installer/bootdev is set by partman/early_command -d-i grub-installer/bootdev seen true -d-i grub-installer/choose_bootdev string manual -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 590914a7..bd712a08 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-jessie.cfg.j2 @@ -57,13 +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 - -## grub-installer/bootdev is set by partman/early_command -d-i grub-installer/bootdev seen true -d-i grub-installer/choose_bootdev string manual -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 02902b77..487e4727 100644 --- a/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_debian-stretch.cfg.j2 @@ -57,13 +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 - -## grub-installer/bootdev is set by partman/early_command -d-i grub-installer/bootdev seen true -d-i grub-installer/choose_bootdev string manual -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 e80d38ae..b8562e2e 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-bionic.cfg.j2 @@ -66,13 +66,6 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none - -## grub-installer/bootdev is set by partman/early_command -d-i grub-installer/bootdev seen true -d-i grub-installer/choose_bootdev string manual -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 8442cd31..d8208a5e 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-focal.cfg.j2 @@ -66,13 +66,6 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none - -## grub-installer/bootdev is set by partman/early_command -d-i grub-installer/bootdev seen true -d-i grub-installer/choose_bootdev string manual -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 d4ca1b30..0387027f 100644 --- a/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 +++ b/roles/installer/debian/preseed/templates/preseed_ubuntu-xenial.cfg.j2 @@ -63,13 +63,6 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none - -## grub-installer/bootdev is set by partman/early_command -d-i grub-installer/bootdev seen true -d-i grub-installer/choose_bootdev string manual -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 d3295872..4927e00b 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 @@ -69,13 +69,6 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none - -## grub-installer/bootdev is set by partman/early_command -d-i grub-installer/bootdev seen true -d-i grub-installer/choose_bootdev string manual -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 -- cgit v1.2.3 From c750374c93682f18b4e91dec3c88dfdd1a8af3e2 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 29 Jun 2020 01:28:43 +0200 Subject: simplified partman early command --- inventory/host_vars/sk-testvm.yml | 9 +++++-- roles/installer/debian/preseed/tasks/main.yml | 2 +- .../debian/preseed/templates/partman_config.j2 | 28 ++++++++++++---------- .../preseed/templates/partman_early-command.sh.j2 | 17 +++++++------ roles/vm/define/templates/libvirt-domain.xml.j2 | 2 +- 5 files changed, 33 insertions(+), 25 deletions(-) (limited to 'roles/installer/debian/preseed') diff --git a/inventory/host_vars/sk-testvm.yml b/inventory/host_vars/sk-testvm.yml index c61dc4e1..63538708 100644 --- a/inventory/host_vars/sk-testvm.yml +++ b/inventory/host_vars/sk-testvm.yml @@ -5,11 +5,16 @@ install: numcpu: 1 autostart: False disks: - primary: /dev/sda + primary: software-raid + raid: + level: 1 + members: + - /dev/sda + - /dev/sdb scsi: sda: type: zfs - name: root + name: root1 size: 10g sdb: type: zfs diff --git a/roles/installer/debian/preseed/tasks/main.yml b/roles/installer/debian/preseed/tasks/main.yml index 53e9d225..599d9ddb 100644 --- a/roles/installer/debian/preseed/tasks/main.yml +++ b/roles/installer/debian/preseed/tasks/main.yml @@ -10,7 +10,7 @@ src: "preseed_{{ hostvars[install_hostname].preseed_template_name | default(install_distro + '-' + install_codename) }}.cfg.j2" dest: "{{ preseed_tmpdir }}/preseed.cfg" -- name: Generate partman early-command +- name: Generate partmam early-command script template: src: "partman_early-command.sh.j2" dest: "{{ preseed_tmpdir }}/partman_early-command.sh" diff --git a/roles/installer/debian/preseed/templates/partman_config.j2 b/roles/installer/debian/preseed/templates/partman_config.j2 index ebaf180e..2d125b50 100644 --- a/roles/installer/debian/preseed/templates/partman_config.j2 +++ b/roles/installer/debian/preseed/templates/partman_config.j2 @@ -1,3 +1,4 @@ +{# 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 @@ -9,11 +10,6 @@ d-i partman-lvm/device_remove_lvm boolean true d-i partman-lvm/confirm boolean true d-i partman-lvm/confirm_nooverwrite boolean true -{% 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/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 @@ -28,35 +24,44 @@ d-i partman/choose_label string dos d-i partman/default_label string dos {% 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/choose_recipe select ansible d-i partman-auto/expert_recipe string \ ansible :: \ {% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} 100 100 128 fat16 \ - $defaultignore{ } $primary{ } $bootable{ } \ + $primary{ } $bootable{ } \ method{ efi } format{ } \ . \ {% endif %} {% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %} 256 10000 256 raid \ - $lvmignore{ } $primary{ } method{ raid } \ + $lvmignore{ } $primary{ } $bootable{ } \ + method{ raid } \ . \ 1000 10000 -1 raid \ - $lvmignore{ } $primary{ } method{ raid } \ + $lvmignore{ } $primary{ } \ + method{ raid } \ . \ {% endif %} 1000 10000 -1 ext4 \ $defaultignore{ } $primary{ } $bootable{ } \ method{ lvm } vg_name{ {{ hostvars[install_hostname].host_name }} } \ . \ - 2560 10000 2560 ext4 \ + 2048 10000 2560 ext4 \ $defaultignore{ } $lvmok{ } \ in_vg{ {{ hostvars[install_hostname].host_name }} } \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ / } \ . \ - 1280 10000 1280 ext4 \ + 1024 10000 1280 ext4 \ $defaultignore{ } $lvmok{ } \ in_vg{ {{ hostvars[install_hostname].host_name }} } \ method{ format } format{ } \ @@ -86,6 +91,5 @@ d-i partman/choose_partition select finish ## boot devices are configured by partman/early_command -d-i grub-installer/bootdev seen true d-i grub-installer/only_debian boolean true -d-i grub-installer/with_other_os boolean false +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 index 08d3806d..9c720e92 100644 --- a/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 +++ b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 @@ -4,30 +4,29 @@ umount -l /media || true {% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %} -raid_disks="$(readlink -f {{ install_cooked.disks.raid.members | join(' ') }} | xargs)" -raid_config="{{ install_cooked.disks.raid.level }} {{ install_cooked.disks.raid.members | length }} 0" +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 $raid_disks; do +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"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"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 ." -debconf-set partman-auto/disk "$raid_disks" -debconf-set grub-installer/bootdev "$raid_disks" {% else %} -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 }})" +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 diff --git a/roles/vm/define/templates/libvirt-domain.xml.j2 b/roles/vm/define/templates/libvirt-domain.xml.j2 index af9fbf52..be2fd8b4 100644 --- a/roles/vm/define/templates/libvirt-domain.xml.j2 +++ b/roles/vm/define/templates/libvirt-domain.xml.j2 @@ -9,7 +9,7 @@ {% if install_distro == 'debian' or install_distro == 'ubuntu' %} {{ installer_path }}/{{ install_distro }}-{{ install_codename }}/{{ hostvars[install_hostname].install_cooked.arch | default('amd64') }}/linux {{ preseed_tmpdir }}/initrd.preseed.gz - console=ttyS0,115200n8 + console=ttyS0,115200n8 DEBCONF_DEBUG=5 {% elif install_distro == 'openbsd' %} -- cgit v1.2.3 From ee6843f01f382ac81a6ea48f7c3c074e56b5a996 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 2 Jul 2020 02:00:06 +0200 Subject: another attempt to tackle root_lvm_size issue --- inventory/host_vars/sk-testvm.yml | 26 ++++++------ .../debian/preseed/templates/partman_config.j2 | 48 ++++++++++++++++------ .../preseed/templates/partman_early-command.sh.j2 | 6 +++ 3 files changed, 55 insertions(+), 25 deletions(-) (limited to 'roles/installer/debian/preseed') diff --git a/inventory/host_vars/sk-testvm.yml b/inventory/host_vars/sk-testvm.yml index cad79e49..73012082 100644 --- a/inventory/host_vars/sk-testvm.yml +++ b/inventory/host_vars/sk-testvm.yml @@ -5,21 +5,23 @@ install: numcpus: 1 autostart: False disks: - primary: software-raid - raid: - level: 1 - members: - - /dev/sda - - /dev/sdb + # primary: software-raid + # raid: + # level: 1 + # members: + # - /dev/sda + # - /dev/sdb + primary: /dev/sda + root_lvm_size: 10G scsi: sda: type: zfs - name: root1 - size: 10g - sdb: - type: zfs - name: root2 - size: 10g + name: root + size: 20g + # sdb: + # type: zfs + # name: root2 + # size: 10g interfaces: - bridge: br-public name: primary0 diff --git a/roles/installer/debian/preseed/templates/partman_config.j2 b/roles/installer/debian/preseed/templates/partman_config.j2 index 2d125b50..88b6a088 100644 --- a/roles/installer/debian/preseed/templates/partman_config.j2 +++ b/roles/installer/debian/preseed/templates/partman_config.j2 @@ -19,9 +19,17 @@ d-i partman-auto-lvm/no_boot boolean true 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 dos -d-i partman/default_label string dos +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 %} @@ -31,44 +39,56 @@ d-i partman-auto/method string raid d-i partman-auto/method string lvm {% endif %} -d-i partman-auto/choose_recipe select ansible d-i partman-auto/expert_recipe string \ ansible :: \ {% if (hostvars[install_hostname].install_cooked.efi | default(false)) %} - 100 100 128 fat16 \ + 128 128 128 fat16 \ $primary{ } $bootable{ } \ method{ efi } format{ } \ . \ {% endif %} {% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %} - 256 10000 256 raid \ + 256 256 256 raid \ $lvmignore{ } $primary{ } $bootable{ } \ method{ raid } \ . \ - 1000 10000 -1 raid \ + 10240 10340 -1 raid \ $lvmignore{ } $primary{ } \ method{ raid } \ . \ -{% endif %} - 1000 10000 -1 ext4 \ - $defaultignore{ } $primary{ } $bootable{ } \ +{% 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 }} } \ . \ - 2048 10000 2560 ext4 \ + 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{ / } \ . \ - 1024 10000 1280 ext4 \ + 1280 1280 1280 ext4 \ $defaultignore{ } $lvmok{ } \ in_vg{ {{ hostvars[install_hostname].host_name }} } \ method{ format } format{ } \ use_filesystem{ } filesystem{ ext4 } \ mountpoint{ /var } \ . \ - 768 10000 768 ext4 \ + 768 768 768 ext4 \ $defaultignore{ } $lvmok{ } \ in_vg{ {{ hostvars[install_hostname].host_name }} } \ method{ format } format{ } \ @@ -78,13 +98,15 @@ d-i partman-auto/expert_recipe string options/noatime{ noatime } \ options/noexec{ noexec } \ . \ - 16 20000 -1 ext4 \ + 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 diff --git a/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 index 9c720e92..6187fbea 100644 --- a/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 +++ b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 @@ -31,3 +31,9 @@ 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 + + +## wipe existing partition tables, 1M should be enough to get rid of them +for disk in $disks; do + dd if=/dev/zero "of=$disk" bs=32768 count=32 +done -- cgit v1.2.3 From 2f00ada542d9ac3c29ce3d6af9a2fad994413d09 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 3 Jul 2020 01:52:18 +0200 Subject: preseed: software-raid with root_lvm_size works now --- roles/installer/debian/preseed/templates/partman_config.j2 | 14 +++++++++++++- .../debian/preseed/templates/partman_early-command.sh.j2 | 6 ------ 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'roles/installer/debian/preseed') diff --git a/roles/installer/debian/preseed/templates/partman_config.j2 b/roles/installer/debian/preseed/templates/partman_config.j2 index 88b6a088..ca6feb41 100644 --- a/roles/installer/debian/preseed/templates/partman_config.j2 +++ b/roles/installer/debian/preseed/templates/partman_config.j2 @@ -52,10 +52,22 @@ d-i partman-auto/expert_recipe string $lvmignore{ } $primary{ } $bootable{ } \ method{ raid } \ . \ - 10240 10340 -1 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 %} diff --git a/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 index 6187fbea..9c720e92 100644 --- a/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 +++ b/roles/installer/debian/preseed/templates/partman_early-command.sh.j2 @@ -31,9 +31,3 @@ 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 - - -## wipe existing partition tables, 1M should be enough to get rid of them -for disk in $disks; do - dd if=/dev/zero "of=$disk" bs=32768 count=32 -done -- cgit v1.2.3 From 972a2ec5dbc6da4b8ee36079220c1dba8696f593 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 3 Jul 2020 02:00:29 +0200 Subject: use new preseed config in some hosts --- inventory/host_vars/ch-oulu.yml | 9 ++- inventory/host_vars/ele-calypso.yml | 11 +++- inventory/host_vars/sk-testvm.yml | 13 +--- .../debian/preseed/templates/partman_ws_config.j2 | 72 --------------------- .../templates/preseed_xubuntu-focal-desktop.cfg.j2 | 73 +++++++++++++++++++++- 5 files changed, 88 insertions(+), 90 deletions(-) delete mode 100644 roles/installer/debian/preseed/templates/partman_ws_config.j2 (limited to 'roles/installer/debian/preseed') diff --git a/inventory/host_vars/ch-oulu.yml b/inventory/host_vars/ch-oulu.yml index b5b86138..d0d035d2 100644 --- a/inventory/host_vars/ch-oulu.yml +++ b/inventory/host_vars/ch-oulu.yml @@ -2,8 +2,13 @@ install: efi: true disks: - primary: /dev/disk/by-id/nvme-Samsung_SSD_970_PRO_1TB_S462NF0M800161Z - # primary: /dev/disk/by-id/nvme-Samsung_SSD_970_PRO_1TB_S462NF0M800191M + root_lvm_size: 15G + primary: software-raid + raid: + level: 1 + members: + - /dev/disk/by-id/nvme-Samsung_SSD_970_PRO_1TB_S462NF0M800161Z + - /dev/disk/by-id/nvme-Samsung_SSD_970_PRO_1TB_S462NF0M800191M network: nameservers: diff --git a/inventory/host_vars/ele-calypso.yml b/inventory/host_vars/ele-calypso.yml index 865bcebb..ab8fca7c 100644 --- a/inventory/host_vars/ele-calypso.yml +++ b/inventory/host_vars/ele-calypso.yml @@ -1,7 +1,12 @@ --- -preseed_template_name: "debian-buster-with-raid" - -install: {} +install: + disks: + primary: software-raid + raid: + level: 1 + members: + - /dev/sda + - /dev/sdb network: nameservers: "{{ network_zones.lan.dns }}" diff --git a/inventory/host_vars/sk-testvm.yml b/inventory/host_vars/sk-testvm.yml index 73012082..86c00c1f 100644 --- a/inventory/host_vars/sk-testvm.yml +++ b/inventory/host_vars/sk-testvm.yml @@ -5,23 +5,12 @@ install: numcpus: 1 autostart: False disks: - # primary: software-raid - # raid: - # level: 1 - # members: - # - /dev/sda - # - /dev/sdb primary: /dev/sda - root_lvm_size: 10G scsi: sda: type: zfs name: root - size: 20g - # sdb: - # type: zfs - # name: root2 - # size: 10g + size: 10g interfaces: - bridge: br-public name: primary0 diff --git a/roles/installer/debian/preseed/templates/partman_ws_config.j2 b/roles/installer/debian/preseed/templates/partman_ws_config.j2 deleted file mode 100644 index 54fe94f1..00000000 --- a/roles/installer/debian/preseed/templates/partman_ws_config.j2 +++ /dev/null @@ -1,72 +0,0 @@ -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 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-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 -{% 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 }} } \ - . \ - 15360 10000 20480 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ / } \ - . \ - 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 } \ - . \ - 20480 10000 40960 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - method{ format } format{ } \ - use_filesystem{ } filesystem{ ext4 } \ - mountpoint{ /home } \ - . \ - 16 20000 -1 ext4 \ - $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ - lv_name{ dummy } \ - . - -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/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 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 4927e00b..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 @@ -57,7 +57,78 @@ d-i time/zone string Europe/Vienna d-i clock-setup/ntp boolean false -{% include 'partman_ws_config.j2' %} +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 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-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 +{% 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 }} } \ + . \ + 15360 10000 20480 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ / } \ + . \ + 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 } \ + . \ + 20480 10000 40960 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + method{ format } format{ } \ + use_filesystem{ } filesystem{ ext4 } \ + mountpoint{ /home } \ + . \ + 16 20000 -1 ext4 \ + $lvmok{ } in_vg{ {{ hostvars[install_hostname].host_name }} } \ + lv_name{ dummy } \ + . + +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/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 -- cgit v1.2.3