packer-hcloud/rocky-9/data/init.ks.pkrtpl.hcl

174 lines
5.6 KiB
HCL
Raw Normal View History

2022-09-08 13:01:32 +00:00
### Install from network
### Configure network information for target system and activate network devices in the installer environment (optional)
### --onboot enable device at a boot time
### --device device to be activated and / or configured with the network command
### --bootproto method to obtain networking configuration for device (default dhcp)
### --noipv6 disable IPv6 on this device
###
### network --bootproto=static --ip=172.16.11.200 --netmask=255.255.255.0 --gateway=172.16.11.200 --nameserver=172.16.11.4 --hostname centos-linux-8
network --bootproto=dhcp --device=link --activate --onboot=on
### Use the Hetzner mirror for fast installations
url --url="${hcloud_mirror}/BaseOS/x86_64/os/"
repo --name="AppStream" --baseurl="${hcloud_mirror}/AppStream/x86_64/os/"
### Performs the kickstart installation in text mode.
### By default, kickstart installations are performed in graphical mode.
text
### Accepts the End User License Agreement.
eula --agreed
### Sets the language to use during installation and the default language to use on the installed system.
lang ${vm_guest_os_language}
### Sets the default keyboard type for the system.
keyboard ${vm_guest_os_keyboard}
### Set initial root password
rootpw --iscrypted ${build_password_encrypted}
### Configure firewall settings for the system.
### --enabled reject incoming connections that are not in response to outbound requests
### --ssh allow sshd service through the firewall
firewall --enabled --ssh
### Sets up the authentication options for the system.
### The SSDD profile sets sha512 to hash passwords. Passwords are shadowed by default
### See the manual page for authselect-profile for a complete list of possible options.
authselect select sssd
### Sets the state of SELinux on the installed system.
### Defaults to enforcing.
selinux --enforcing
### Sets the system time zone.
timezone ${vm_guest_os_timezone} --utc
### Sets how the boot loader should be installed.
bootloader --location=mbr
### Initialize any invalid partition tables found on disks.
zerombr
### Removes partitions from the system, prior to creation of new partitions.
### By default, no partitions are removed.
### --linux erases all Linux partitions.
### --initlabel Initializes a disk (or disks) by creating a default disk label for all disks in their respective architecture.
clearpart --all --initlabel
### Modify partition sizes for the virtual machine hardware.
### Create primary system partitions.
part /boot --fstype xfs --size=512 --label=BOOTFS
part /boot/efi --fstype vfat --size=512 --label=EFIFS
part pv.01 --size=19 --grow
### Create a logical volume management (LVM) group.
volgroup vg00 --pesize=4096 pv.01
### Modify logical volume sizes for the virtual machine hardware.
### Create logical volumes.
logvol swap --fstype swap --name=lv_swap --vgname=vg00 --size=2048 --label=SWAPFS
logvol / --fstype xfs --name=lv_root --vgname=vg00 --size=6000 --label=ROOTFS
logvol /home --fstype xfs --name=lv_home --vgname=vg00 --size=3000 --label=HOMEFS
logvol /opt --fstype xfs --name=lv_opt --vgname=vg00 --size=1000 --label=OPTFS
logvol /tmp --fstype xfs --name=lv_tmp --vgname=vg00 --size=512 --label=TMPFS --fsoptions="nosuid,noexec,nodev"
logvol /var --fstype xfs --name=lv_var --vgname=vg00 --size=2000 --label=VARFS --fsoptions="nosuid"
logvol /var/tmp --fstype xfs --name=lv_vartmp --vgname=vg00 --size=512 --label=LOGFS --fsoptions="nosuid,noexec,nodev"
logvol /var/www --fstype xfs --name=lv_www --vgname=vg00 --size=1000 --label=LOGFS --fsoptions="nosuid,noexec,nodev"
logvol /var/log --fstype xfs --name=lv_log --vgname=vg00 --size=1000 --label=LOGFS --fsoptions="nosuid,noexec,nodev"
logvol /var/log/audit --fstype xfs --name=lv_audit --vgname=vg00 --size=512 --label=AUDITFS --fsoptions="nosuid,noexec,nodev"
### Modifies the default set of services that will run under the default runlevel.
services --enabled=NetworkManager,sshd
### Do not configure X on the installed system.
skipx
### Disable firstboot.
firstboot --disable
### Packages selection.
%packages
@^minimal-environment
kexec-tools
openssh-server
openssh-clients
sudo
curl
python3
python3-libselinux
jq
-aic94xx-firmware
-atmel-firmware
-b43-openfwwf
-bfa-firmware
-ipw2100-firmware
-ipw2200-firmware
-ivtv-firmware
-iwl100-firmware
-iwl1000-firmware
-iwl3945-firmware
-iwl4965-firmware
-iwl5000-firmware
-iwl5150-firmware
-iwl6000-firmware
-iwl6000g2a-firmware
-iwl6050-firmware
-libertas-usb8388-firmware
-ql2100-firmware
-ql2200-firmware
-ql23xx-firmware
-ql2400-firmware
-ql2500-firmware
-rt61pci-firmware
-rt73usb-firmware
-xorg-x11-drv-ati-firmware
-zd1211-firmware
%end
### Post-installation commands.
%post
dnf makecache
dnf install -y epel-release
dnf makecache
dnf install -y cloud-init
dnf clean all
touch /etc/cloud/cloud-init.disabled
cat >/etc/cloud/cloud.cfg.d/90-hetznercloud.cfg <<EOF
${files_hetznercloud_default_init}
EOF
cat >/etc/cloud/cloud.cfg.d/92-hetznercloud-ds.cfg <<EOF
${files_hetznercloud_ds_init}
EOF
cat >/etc/cloud/cloud.cfg.d/93-hetznercloud.cfg <<EOF
${files_hetznercloud_init}
EOF
mkdir -p /etc/systemd/system/getty@tty1.service.d
cat >/etc/systemd/system/getty@tty1.service.d/override.conf <<EOF
[Unit]
After=cloud-init.target
EOF
2022-09-08 13:01:32 +00:00
echo "Completed cloud-init step!"
cat >/usr/local/bin/hcloud-metadata <<\EOF
${files_hcloud_metadata}
EOF
chmod 700 /usr/local/bin/hcloud-metadata
mkdir /root/.ssh/
chmod 700 /root/.ssh/
cat >/etc/systemd/system/hcloud-ssh-keys.service <<EOF
${files_hcloud_ssh_keys_service}
EOF
systemctl enable hcloud-ssh-keys.service
%end
### Reboot after the installation is complete.
### --eject attempt to eject the media before rebooting.
reboot --eject