blob: f13290e45d94e6cc3a3ba808eabeb7d55076ec64 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/bin/sh
umount -l /media || true
{% if hostvars[install_hostname].install_cooked.disks.primary == "software-raid" %}
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 $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"2
else
raid_members_boot="$raid_members_boot$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 ."
{% else %}
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
db_fset grub-installer/bootdev seen true
mkdir -p /lib/partman/not-enough-space.d/
cat <<EOF > /lib/partman/not-enough-space.d/00-ansible
#!/bin/sh
. /usr/share/debconf/confmodule
db_input critical partman-auto/autopartitioning_failed || true
db_go || true
exit 1
EOF
chmod +x /lib/partman/not-enough-space.d/00-ansible
|