From a93773afc2e512f5a6c04326825df17c8899fd43 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 14 Apr 2019 19:09:49 +0200 Subject: hetzner smaller root lv --- .../cloud-install/templates/hetzner_postinst.sh.j2 | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'roles/cloud-install/templates/hetzner_postinst.sh.j2') diff --git a/roles/cloud-install/templates/hetzner_postinst.sh.j2 b/roles/cloud-install/templates/hetzner_postinst.sh.j2 index 3ee5a390..2835b477 100644 --- a/roles/cloud-install/templates/hetzner_postinst.sh.j2 +++ b/roles/cloud-install/templates/hetzner_postinst.sh.j2 @@ -21,6 +21,25 @@ sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[hostname].ansible_port }}/' -i /e {% endif %} {# this is actually only needed on ubuntu bionic and beyond but should not hurt on other installations either #} -swapoff -a; sed -e '/^\/swapfile/d' -i /etc/fstab; rm -f /swapfile +swapoff -a +sed -e '/^\/swapfile/d' -i /etc/fstab +rm -f /swapfile + +{% if hetzner_root_lvm_size != "all" %} +umount /dummy +sed -e '/\/dummy/d' -i /etc/fstab +rm -rf /dummy + +raid_devices=$(mdadm -Q -Y --detail /dev/md2 2> /dev/null | awk -F = '/MD_DEVICE_.*_DEV=/ { print($2) }') +if [ -n "$raid_devices" ]; then + mdadm --stop /dev/md2 2> /dev/null + for dev in $raid_devices; do + wipefs -a "$dev" + done + sed -e '/^ARRAY \/dev\/md\/2 /d' -i /etc/mdadm/mdadm.conf + update-initramfs -u +fi +{% endif %} + echo "postinst.sh finished successfully" -- cgit v1.2.3