preseed/install: make disk selection work with udev device paths
authorChristian Pointner <equinox@realraum.at>
Wed, 9 Jan 2019 01:08:47 +0000 (02:08 +0100)
committerChristian Pointner <equinox@realraum.at>
Wed, 9 Jan 2019 01:08:47 +0000 (02:08 +0100)
ansible/host_vars/ctf/main.yml
ansible/host_vars/gnocchi0/main.yml
ansible/host_vars/gnocchi1/main.yml
ansible/host_vars/testvm/main.yml
ansible/roles/preseed/templates/preseed_debian-stretch.cfg.j2
ansible/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2
ansible/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2

index df12cda..c59fc37 100644 (file)
@@ -20,7 +20,7 @@ install:
   mem: 2048
   numcpu: 2
   disks:
-    primary: vda
+    primary: /dev/vda
     virtio:
       vda:
         vg: "{{ vm_host }}"
index 623ef3c..d1fc949 100644 (file)
@@ -10,4 +10,4 @@ network:
 
 install:
   disks:
-    primary: sda
+    primary: /dev/disk/by-id/ata-KINGSTON_SMS200S360G_50026B726A0002A2
index 537e7d5..008bc57 100644 (file)
@@ -10,4 +10,4 @@ network:
 
 install:
   disks:
-    primary: sda
+    primary: /dev/disk/by-id/ata-KINGSTON_SMS200S360G_50026B726A00DFF4
index 1d0c62a..b02e9bb 100644 (file)
@@ -8,7 +8,7 @@ install:
   mem: 1024
   numcpu: 2
   disks:
-    primary: vda
+    primary: /dev/vda
     virtio:
       vda:
         vg: "{{ vm_host }}"
index d7a21a8..ee8d48a 100644 (file)
@@ -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
 
index be37537..17e7b2e 100644 (file)
@@ -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
 
index 73daa33..950472c 100644 (file)
@@ -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