|
| 1 | +#Generated by packer-kvm/build-packer-templates.yaml |
| 2 | + |
| 3 | +#auth --enableshadow --passalgo=sha512 |
| 4 | +url --url="https://download.rockylinux.org/pub/rocky/10/BaseOS/x86_64/kickstart/" |
| 5 | +text |
| 6 | +firstboot --disable |
| 7 | +keyboard --vckeymap=us --xlayouts='us' |
| 8 | +lang en_US.UTF-8 |
| 9 | +network --bootproto=dhcp --device=eth0 --ipv6=auto --activate |
| 10 | +network --hostname=centos10.localdomain |
| 11 | +selinux --disabled |
| 12 | +rootpw testtest |
| 13 | +user --groups=wheel --name=user --password=testtest --uid=1000 --gecos="user" --gid=1000 |
| 14 | +sshkey --username=user"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDUXg2vJmOBNIHd5j6gWFBs0/I4IWXp1jIHBn93FyUQsgiVOG82jhCA69G2SqCYbZHRJSJhwOFSMtMsvDno5Gz+tZMSASliiQnDD26YxiqZZUOApqCpdYKYEhwjVcokjKfm1rVdYhysk1K/qmlL6D0SVAzZxsepl7x8JksMVjvOsuGsZywsvh/Ck7JqEMt9O/NDWv0iFGkGy7J888eAnc+bMyiVV4ND+yYPqpCtL+fPU/dY7+LMR9uDoiJK8fAOmCrBvRLwmKOCh4NNRsHk58L36gl3ArUpNlqWrotpLROHhrXcuh4hSmPuTVsxQOTrzaHM2oVkw/+LBpFFqMLJrAaM8sVrfUBAhRD91cFHjazXg7RvXE1dbkPWDH6THJ71CS1FLyz2htMd7nYuJX/3J2bk533JKZVy/nOEtb0k2s1yCw4WNhT7M+RSFjsvgFsJJkvcGKPpIUwdkctzAXj4hAC1sdhiLsdh/j9E5yw2Tr6rRZ4nuBGDUOqlHABSZBm1d6k= packer-kvm-default-key" |
| 15 | +sshkey --username=root"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDUXg2vJmOBNIHd5j6gWFBs0/I4IWXp1jIHBn93FyUQsgiVOG82jhCA69G2SqCYbZHRJSJhwOFSMtMsvDno5Gz+tZMSASliiQnDD26YxiqZZUOApqCpdYKYEhwjVcokjKfm1rVdYhysk1K/qmlL6D0SVAzZxsepl7x8JksMVjvOsuGsZywsvh/Ck7JqEMt9O/NDWv0iFGkGy7J888eAnc+bMyiVV4ND+yYPqpCtL+fPU/dY7+LMR9uDoiJK8fAOmCrBvRLwmKOCh4NNRsHk58L36gl3ArUpNlqWrotpLROHhrXcuh4hSmPuTVsxQOTrzaHM2oVkw/+LBpFFqMLJrAaM8sVrfUBAhRD91cFHjazXg7RvXE1dbkPWDH6THJ71CS1FLyz2htMd7nYuJX/3J2bk533JKZVy/nOEtb0k2s1yCw4WNhT7M+RSFjsvgFsJJkvcGKPpIUwdkctzAXj4hAC1sdhiLsdh/j9E5yw2Tr6rRZ4nuBGDUOqlHABSZBm1d6k= packer-kvm-default-key" |
| 16 | +timezone Europe/Paris --utc |
| 17 | +bootloader --location=mbr --append=" net.ifnames=0 biosdevname=0 crashkernel=no" |
| 18 | +# Clear the Master Boot Record |
| 19 | +zerombr |
| 20 | +# Remove partitions |
| 21 | +clearpart --all --initlabel |
| 22 | +# Automatically create partitions using LVM |
| 23 | +autopart --type=lvm |
| 24 | +# Reboot after successful installation |
| 25 | +reboot |
| 26 | + |
| 27 | +%packages --excludedocs |
| 28 | +sudo |
| 29 | +qemu-guest-agent |
| 30 | +openssh-server |
| 31 | +-kexec-tools |
| 32 | +-dracut-config-rescue |
| 33 | +-plymouth* |
| 34 | +-iwl*firmware |
| 35 | +%end |
| 36 | + |
| 37 | +%addon com_redhat_kdump --disable |
| 38 | +%end |
| 39 | + |
| 40 | +%post |
| 41 | +# Update time |
| 42 | +#/usr/sbin/ntpdate -bu 0.fr.pool.ntp.org 1.fr.pool.ntp.org |
| 43 | + |
| 44 | +#sed -i 's/^.*requiretty/#Defaults requiretty/' /etc/sudoers |
| 45 | +sed -i's/rhgb //' /etc/default/grub |
| 46 | + |
| 47 | +# Disable consistent network device naming |
| 48 | +#/usr/bin/ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules |
| 49 | + |
| 50 | +# sshd PermitRootLogin yes |
| 51 | +sed -i"s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config |
| 52 | +#echo "user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers |
| 53 | +cat <<EOF >> /etc/sudoers |
| 54 | +Defaults !requiretty |
| 55 | +rootALL=(ALL) ALL |
| 56 | +userALL=(ALL) NOPASSWD: ALL |
| 57 | +EOF |
| 58 | + |
| 59 | +# Enable NetworkManager, sshd and disable firewalld |
| 60 | +#/usr/bin/systemctl enable NetworkManager |
| 61 | +/usr/bin/systemctl enable sshd |
| 62 | +/usr/bin/systemctl start sshd |
| 63 | +#/usr/bin/systemctl disable firewalld |
| 64 | + |
| 65 | +# Need for host/guest communication |
| 66 | +/usr/bin/systemctl enable qemu-guest-agent |
| 67 | +/usr/bin/systemctl start qemu-guest-agent |
| 68 | + |
| 69 | +# Update all packages |
| 70 | +#/usr/bin/dnf -y update |
| 71 | +#/usr/bin/dnf clean all |
| 72 | + |
| 73 | +# Not really needed since the kernel update already did this. Furthermore, |
| 74 | +# running this here reverts the grub menu to the current kernel. |
| 75 | +grub2-mkconfig -o /boot/grub2/grub.cfg |
| 76 | +%end |