Created
October 28, 2021 14:30
-
-
Save johnsimcall/6feee6e4e5aa05745645a615c146fb27 to your computer and use it in GitHub Desktop.
Example oVirt Node kickstart (from Red Hat Virtualization 4.3 era)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#liveimg --url=file:///tmp/squashfs ### use this line when booting from ISO/USB | |
liveimg --url=http://nas/redhat-virtualization-host-latest.squashfs.img | |
lang en_US | |
keyboard us | |
timezone America/Denver --utc | |
rootpw --plaintext redhat1 | |
network --device=link --bootproto=dhcp | |
%include /tmp/partitions | |
reboot | |
%pre ### Setup liveimg from ISO/USB. This section is not needed when installing via PXE | |
cd /tmp | |
rpm2cpio /run/install/repo/Packages/redhat-virtualization-host-image-update* | cpio -ivd | |
squashfs=$(find | grep squashfs | grep -v meta) | |
ln -s $squashfs /tmp/squashfs | |
%end | |
%pre ### ERASE EVERYTHING!!! | |
INSTALL_LABEL="RHVH-4.3 RHVH.x86_64" | |
echo "DANGER -- Wiping all disks; except loopbacks, roms, and installaion media with label \"$INSTALL_LABEL\"" | |
# Remove any/all LVM Logical Volumes and Volume Groups | |
for VG in $(lvm vgs -o vg_name --noheadings); do | |
lvm vgremove $VG --force | |
done | |
# Remove any/all LVM Physical Volumes | |
for PV in $(lvm pvs -o pv_name --noheadings); do | |
lvm pvremove $PV | |
done | |
# Remove any Linux/software RAID | |
for i in $(find /dev/md/ -type l); do mdadm --stop $i ; done | |
# Remove any/all partitions and partition-tables (three different ways, just to be sure...) | |
for i in $(lsblk --noheadings --nodeps --exclude 7,11 -o NAME); do | |
THIS_LABEL=$(lsblk --noheadings --nodeps /dev/$i -o LABEL) | |
[ "$THIS_LABEL" == "$INSTALL_LABEL" ] && echo "Skipping installation media on /dev/$i" && echo && continue | |
echo "Wiping /dev/$i" && lsblk --nodeps /dev/$i -o +VENDOR,MODEL | |
wipefs -af /dev/$i && dd if=/dev/zero of=/dev/$i bs=1M count=100 | |
# mkswap is a desperate attempt to TRIM/discard if the device is SSD (really wish we had blkdiscard in anaconda...) | |
mkswap /dev/$i && swapon -v --discard /dev/$i && swapoff -v /dev/$i && wipefs -af /dev/$i | |
done | |
%end | |
%pre ### Create /tmp/partition file to %include later | |
#OSDISK=/dev/sda | |
OSDISK=$(lsblk --noheadings --nodeps --output NAME,VENDOR,MODEL | awk '/INTEL SSD/ {print $1}') | |
cat << EOF >> /tmp/partitions | |
zerombr | |
ignoredisk --only-use=$OSDISK | |
bootloader --boot-drive=$OSDISK --append="rd.luks.allow-discards console=ttyS0,115200" | |
clearpart --all --initlabel --drives=$OSDISK | |
part /boot --fstype=xfs --ondisk=$OSDISK --size=1024 | |
part /boot/efi --fstype=efi --ondisk=$OSDISK --size=256 --fsoptions="umask=0077,shortname=winnt" | |
part pv.01 --ondisk=$OSDISK --size=71680 | |
volgroup RHVH pv.01 --reserved-space 1024 | |
logvol none --vgname=RHVH --thinpool --size=1 --name=RHVHpool --grow | |
logvol swap --vgname=RHVH --fstype=swap --size=1024 --name=swap --fsoptions="defaults,discard" | |
logvol / --vgname=RHVH --fstype=xfs --size=6144 --name=root --poolname=RHVHpool --thin --fsoptions="defaults,discard" | |
logvol /home --vgname=RHVH --fstype=xfs --size=1024 --name=home --poolname=RHVHpool --thin --fsoptions="defaults,discard" | |
logvol /tmp --vgname=RHVH --fstype=xfs --size=1024 --name=tmp --poolname=RHVHpool --thin --fsoptions="defaults,discard" | |
logvol /var --vgname=RHVH --fstype=xfs --size=22528 --name=var --poolname=RHVHpool --thin --fsoptions="defaults,discard" | |
logvol /var/crash --vgname=RHVH --fstype=xfs --size=10240 --name=var_crash --poolname=RHVHpool --thin --fsoptions="defaults,discard" | |
logvol /var/log --vgname=RHVH --fstype=xfs --size=10240 --name=var_log --poolname=RHVHpool --thin --fsoptions="defaults,discard" | |
logvol /var/log/audit --vgname=RHVH --fstype=xfs --size=2048 --name=var_log_audit --poolname=RHVHpool --thin --fsoptions="defaults,discard" | |
EOF | |
%end | |
# apply STIG and FIPS requirements | |
#%addon org_fedora_oscap | |
# content-type = scap-security-guide | |
# profile = xccdf_org.ssgproject.content_profile_rhelh-vpp | |
#%end | |
%post | |
# Enable LVM discards (SSD TRIM) | |
sed -i.backup 's/issue_discards = 0/issue_discards = 1/' /etc/lvm/lvm.conf | |
%end | |
%post --erroronfail ### This is required for RHV-H | |
cp /run/install/ks.cfg /root/ks.cfg | |
imgbase layout --init | |
%end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment