summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inventory/host_vars/sk-testvm.yml26
-rw-r--r--roles/installer/debian/preseed/templates/partman_config.j248
-rw-r--r--roles/installer/debian/preseed/templates/partman_early-command.sh.j26
3 files changed, 55 insertions, 25 deletions
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