From 21bf2a6af24fc93a3eb0d12d09f10e866a1b39f6 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 9 Jan 2019 02:08:47 +0100 Subject: [PATCH] preseed/install: make disk selection work with udev device paths --- ansible/host_vars/ctf/main.yml | 2 +- ansible/host_vars/gnocchi0/main.yml | 2 +- ansible/host_vars/gnocchi1/main.yml | 2 +- ansible/host_vars/testvm/main.yml | 2 +- .../roles/preseed/templates/preseed_debian-stretch.cfg.j2 | 10 ++++++++-- ansible/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 | 10 ++++++++-- ansible/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 | 10 ++++++++-- 7 files changed, 28 insertions(+), 10 deletions(-) diff --git a/ansible/host_vars/ctf/main.yml b/ansible/host_vars/ctf/main.yml index df12cda..c59fc37 100644 --- a/ansible/host_vars/ctf/main.yml +++ b/ansible/host_vars/ctf/main.yml @@ -20,7 +20,7 @@ install: mem: 2048 numcpu: 2 disks: - primary: vda + primary: /dev/vda virtio: vda: vg: "{{ vm_host }}" diff --git a/ansible/host_vars/gnocchi0/main.yml b/ansible/host_vars/gnocchi0/main.yml index 623ef3c..d1fc949 100644 --- a/ansible/host_vars/gnocchi0/main.yml +++ b/ansible/host_vars/gnocchi0/main.yml @@ -10,4 +10,4 @@ network: install: disks: - primary: sda + primary: /dev/disk/by-id/ata-KINGSTON_SMS200S360G_50026B726A0002A2 diff --git a/ansible/host_vars/gnocchi1/main.yml b/ansible/host_vars/gnocchi1/main.yml index 537e7d5..008bc57 100644 --- a/ansible/host_vars/gnocchi1/main.yml +++ b/ansible/host_vars/gnocchi1/main.yml @@ -10,4 +10,4 @@ network: install: disks: - primary: sda + primary: /dev/disk/by-id/ata-KINGSTON_SMS200S360G_50026B726A00DFF4 diff --git a/ansible/host_vars/testvm/main.yml b/ansible/host_vars/testvm/main.yml index 1d0c62a..b02e9bb 100644 --- a/ansible/host_vars/testvm/main.yml +++ b/ansible/host_vars/testvm/main.yml @@ -8,7 +8,7 @@ install: mem: 1024 numcpu: 2 disks: - primary: vda + primary: /dev/vda virtio: vda: vg: "{{ vm_host }}" diff --git a/ansible/roles/preseed/templates/preseed_debian-stretch.cfg.j2 b/ansible/roles/preseed/templates/preseed_debian-stretch.cfg.j2 index d7a21a8..ee8d48a 100644 --- a/ansible/roles/preseed/templates/preseed_debian-stretch.cfg.j2 +++ b/ansible/roles/preseed/templates/preseed_debian-stretch.cfg.j2 @@ -41,7 +41,14 @@ d-i time/zone string Europe/Vienna d-i clock-setup/ntp boolean false -d-i partman-auto/disk string /dev/{{ hostvars[hostname].install_cooked.disks.primary }} +d-i partman/early_command string \ + debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + umount -l /media || true + +d-i grub-installer/choose_bootdev string manual +d-i grub-installer/bootdev seen true + d-i partman-auto/method string lvm d-i partman-auto/purge_lvm_from_device boolean true d-i partman-auto-lvm/new_vg_name string {{ hostname }} @@ -100,7 +107,6 @@ d-i pkgsel/include string openssh-server python d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false -d-i grub-installer/choose_bootdev string /dev/{{ hostvars[hostname].install_cooked.disks.primary }} d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean false diff --git a/ansible/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 b/ansible/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 index be37537..17e7b2e 100644 --- a/ansible/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 +++ b/ansible/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2 @@ -46,7 +46,14 @@ d-i time/zone string Europe/Vienna d-i clock-setup/ntp boolean false -d-i partman-auto/disk string /dev/{{ hostvars[hostname].install_cooked.disks.primary }} +d-i partman/early_command string \ + debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + umount -l /media || true + +d-i grub-installer/choose_bootdev string manual +d-i grub-installer/bootdev seen true + d-i partman-auto/method string lvm d-i partman-auto/purge_lvm_from_device boolean true d-i partman-auto-lvm/new_vg_name string {{ hostname }} @@ -106,7 +113,6 @@ d-i pkgsel/upgrade select safe-upgrade popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none -d-i grub-installer/choose_bootdev string /dev/{{ hostvars[hostname].install_cooked.disks.primary }} d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean false diff --git a/ansible/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 b/ansible/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 index 73daa33..950472c 100644 --- a/ansible/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 +++ b/ansible/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2 @@ -46,7 +46,14 @@ d-i time/zone string Europe/Vienna d-i clock-setup/ntp boolean false -d-i partman-auto/disk string /dev/{{ hostvars[hostname].install_cooked.disks.primary }} +d-i partman/early_command string \ + debconf-set partman-auto/disk "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + debconf-set grub-installer/bootdev "$(readlink -f {{ hostvars[hostname].install_cooked.disks.primary }})"; \ + umount -l /media || true + +d-i grub-installer/choose_bootdev string manual +d-i grub-installer/bootdev seen true + d-i partman-auto/method string lvm d-i partman-auto/purge_lvm_from_device boolean true d-i partman-auto-lvm/new_vg_name string {{ hostname }} @@ -107,7 +114,6 @@ popularity-contest popularity-contest/participate boolean false d-i pkgsel/update-policy select none d-i base-installer/kernel/override-image string linux-generic-hwe-16.04 -d-i grub-installer/choose_bootdev string /dev/{{ hostvars[hostname].install_cooked.disks.primary }} d-i grub-installer/only_debian boolean true d-i grub-installer/with_other_os boolean false -- 1.7.10.4