summaryrefslogtreecommitdiff
path: root/roles/installer
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2021-06-30 00:13:57 +0200
committerChristian Pointner <equinox@spreadspace.org>2021-06-30 00:14:21 +0200
commited2ea315f6b48700373087e259223e5761069fac (patch)
treee501f3a8ca06c872c3dd0f0362091d1d4045fcb4 /roles/installer
parentfirst workin version of the subiquity based ubuntu installer (diff)
ubuntu installer: add support for software raid (WIP)
Diffstat (limited to 'roles/installer')
-rw-r--r--roles/installer/debian/preseed/templates/partman_config.j24
-rw-r--r--roles/installer/ubuntu/autoinstall/defaults/main.yml2
-rw-r--r--roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2100
3 files changed, 97 insertions, 9 deletions
diff --git a/roles/installer/debian/preseed/templates/partman_config.j2 b/roles/installer/debian/preseed/templates/partman_config.j2
index 9f8c7dcd..39003864 100644
--- a/roles/installer/debian/preseed/templates/partman_config.j2
+++ b/roles/installer/debian/preseed/templates/partman_config.j2
@@ -48,14 +48,14 @@ d-i partman-auto/method string lvm
d-i partman-auto/expert_recipe string \
ansible :: \
{% if (install_cooked.efi | default(false)) %}
-{% set efi_esp_size_mb = (((preseed_efi_esp_size | default(preseed_efi_esp_size)) | human_to_bytes) / (1024*1024)) | int %}
+{% set efi_esp_size_mb = ((preseed_efi_esp_size | human_to_bytes) / (1024*1024)) | int %}
{{ efi_esp_size_mb }} {{ efi_esp_size_mb }} {{ efi_esp_size_mb }} fat16 \
$primary{ } $bootable{ } \
method{ efi } format{ } \
. \
{% endif %}
{% if install_cooked.disks.primary == "software-raid" %}
-{% set swraid_boot_size_mb = (((preseed_swraid_boot_size | default(preseed_swraid_boot_size)) | human_to_bytes) / (1024*1024)) | int %}
+{% set swraid_boot_size_mb = ((preseed_swraid_boot_size | human_to_bytes) / (1024*1024)) | int %}
{{ swraid_boot_size_mb }} {{ swraid_boot_size_mb }} {{ swraid_boot_size_mb }} raid \
$lvmignore{ } $primary{ } $bootable{ } \
method{ raid } \
diff --git a/roles/installer/ubuntu/autoinstall/defaults/main.yml b/roles/installer/ubuntu/autoinstall/defaults/main.yml
index 1a4fd3ed..4af5a42d 100644
--- a/roles/installer/ubuntu/autoinstall/defaults/main.yml
+++ b/roles/installer/ubuntu/autoinstall/defaults/main.yml
@@ -11,7 +11,9 @@ ubuntu_autoinstall_timezone: Europe/Vienna
# ubuntu_autoinstall_kernel_image:
ubuntu_autoinstall_virtual_machine: no
+
ubuntu_autoinstall_efi_esp_size: 128M
+ubuntu_autoinstall_swraid_boot_size: 256M
ubuntu_autoinstall_system_lvm_size_default: all
ubuntu_autoinstall_system_lvm_volumes_default:
diff --git a/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2 b/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2
index 97b54b0a..52eb0d44 100644
--- a/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2
+++ b/roles/installer/ubuntu/autoinstall/templates/autoinstall.yml.j2
@@ -29,19 +29,35 @@ autoinstall:
storage:
config:
+{% if install_cooked.disks.primary != "software-raid" %}
- id: disk-primary
type: disk
path: {{ install_cooked.disks.primary }}
-{% if install_cooked.efi | default(false) %}
+{% if install_cooked.efi | default(false) %}
ptable: gpt
+{% else %}
+ ptable: msdos
+ grub_device: true
+{% endif %}
+ wipe: superblock-recursive
{% else %}
+{% for raid_member in install_cooked.disks.raid.members %}
+ - id: raid-disk{{ loop.index }}
+ type: disk
+ path: {{ raid_member }}
+{% if install_cooked.efi | default(false) %}
+ ptable: gpt
+{% else %}
ptable: msdos
grub_device: true
-{% endif %}
+{% endif %}
wipe: superblock-recursive
+{% endfor %}
+{% endif %}
{% if install_cooked.efi | default(false) %}
{% set part_offset = 1 %}
+{% if install_cooked.disks.primary != "software-raid" %}
- id: partition-esp
type: partition
device: disk-primary
@@ -49,6 +65,25 @@ autoinstall:
number: 1
size: {{ ubuntu_autoinstall_efi_esp_size | human_to_bytes }}
grub_device: true
+{% else %}
+{% for raid_member in install_cooked.disks.raid.members %}
+ - id: raid-partition-esp{{ loop.index }}
+ type: partition
+ device: raid-disk{{ loop.index }}
+ flag: boot
+ number: 1
+ size: {{ ubuntu_autoinstall_efi_esp_size | human_to_bytes }}
+ grub_device: true
+{% endfor %}
+ - id: partition-esp
+ type: raid
+ raidlevel: {{ install_cooked.disks.raid.level }}
+ metadata: 0.90
+ devices:
+{% for raid_member in install_cooked.disks.raid.members %}
+ - raid-partition-esp{{ loop.index }}
+{% endfor %}
+{% endif %}
- id: format-esp
type: format
volume: partition-esp
@@ -61,25 +96,76 @@ autoinstall:
{% else %}
{% set part_offset = 0 %}
+{% endif %}
+{% if install_cooked.disks.primary == "software-raid" %}
+{% for raid_member in install_cooked.disks.raid.members %}
+ - id: raid-partition-boot{{ loop.index }}
+ type: partition
+ device: raid-disk{{ loop.index }}
+ number: {{ part_offset + 1 }}
+ size: {{ ubuntu_autoinstall_swraid_boot_size | human_to_bytes }}
+{% endfor %}
+ - id: partition-boot
+ type: raid
+ raidlevel: {{ install_cooked.disks.raid.level }}
+ devices:
+{% for raid_member in install_cooked.disks.raid.members %}
+ - raid-partition-boot{{ loop.index }}
+{% endfor %}
+ - id: format-boot
+ type: format
+ volume: partition-boot
+ fstype: ext4
+ - id: mount-boot
+ type: mount
+ device: format-boot
+ path: /boot
+{% set part_offset = part_offset + 1 %}
{% endif %}
{% set system_lvm_size = install_cooked.system_lvm.size | default(ubuntu_autoinstall_system_lvm_size_default) %}
{% set system_lvm_volumes = install_cooked.system_lvm.volumes | default(ubuntu_autoinstall_system_lvm_volumes_default) %}
+{% if install_cooked.disks.primary != "software-raid" %}
- id: partition-lvm
type: partition
device: disk-primary
flag: linux
number: {{ part_offset + 1 }}
-{% if system_lvm_size != 'all' %}
+{% if system_lvm_size != 'all' %}
size: {{ system_lvm_size | human_to_bytes }}
- id: partition-unused
type: partition
device: disk-primary
flag: linux
number: {{ part_offset + 2 }}
-{% endif %}
+{% endif %}
size: -1
+{% else %}
+{% for raid_member in install_cooked.disks.raid.members %}
+ - id: raid-partition-lvm{{ loop.index }}
+ type: partition
+ device: raid-disk{{ loop.index }}
+ number: {{ part_offset + 1 }}
+{% if system_lvm_size != 'all' %}
+ size: {{ system_lvm_size | human_to_bytes }}
+ - id: raid-partition-unused{{ loop.index }}
+ type: partition
+ device: raid-disk{{ loop.index }}
+ flag: linux
+ number: {{ part_offset + 2 }}
+{% endif %}
+ size: -1
+{% endfor %}
+ - id: partition-lvm
+ type: raid
+ raidlevel: {{ install_cooked.disks.raid.level }}
+ devices:
+{% for raid_member in install_cooked.disks.raid.members %}
+ - raid-partition-lvm{{ loop.index }}
+{% endfor %}
+
+{% endif %}
- id: lvm-vg-system
type: lvm_volgroup
devices:
@@ -146,9 +232,9 @@ autoinstall:
- curtin in-target --target=/target -- sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ ansible_port }}/' -i /etc/ssh/sshd_config
{% endif %}
- curtin in-target --target=/target -- apt-mark manual iputils-ping isc-dhcp-client netcat-openbsd netplan.io sudo
- - curtin in-target --target=/target -- apt-get -y -q purge policykit-1 multipath-tools ubuntu-minimal unattended-upgrades sound-theme-freedesktop thin-provisioning-tools cryptsetup mdadm byobu open-iscsi btrfs-progs pollinate lxd-agent-loader
-{% if not ubuntu_autoinstall_virtual_machine %}
- - curtin in-target --target=/target -- apt-get -y -q purge open-vm-tools
+ - curtin in-target --target=/target -- apt-get -y -q purge policykit-1 multipath-tools ubuntu-minimal unattended-upgrades sound-theme-freedesktop thin-provisioning-tools cryptsetup byobu open-iscsi btrfs-progs pollinate lxd-agent-loader open-vm-tools
+{% if install_cooked.disks.primary != "software-raid" %}
+ - curtin in-target --target=/target -- apt-get -y -q purge mdadm
{% endif %}
- curtin in-target --target=/target -- env SUDO_FORCE_REMOVE=yes apt-get -y -q purge sudo
- curtin in-target --target=/target -- apt-get -y -q autoremove