This commit is contained in:
95
packer/ova/linux/centos/http/7/ks.cfg
Normal file
95
packer/ova/linux/centos/http/7/ks.cfg
Normal file
@ -0,0 +1,95 @@
|
||||
# Copyright 2019 The Kubernetes Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Perform a fresh install, not an upgrade
|
||||
install
|
||||
cdrom
|
||||
|
||||
# Perform a text installation
|
||||
text
|
||||
|
||||
# Do not install an X server
|
||||
skipx
|
||||
|
||||
# Configure the locale/keyboard
|
||||
lang en_US.UTF-8
|
||||
keyboard us
|
||||
|
||||
# Configure networking
|
||||
network --onboot yes --bootproto dhcp --hostname capv.vm
|
||||
firewall --disabled
|
||||
selinux --permissive
|
||||
timezone UTC
|
||||
|
||||
# Don't flip out if unsupported hardware is detected
|
||||
unsupported_hardware
|
||||
|
||||
# Configure the user(s)
|
||||
auth --enableshadow --passalgo=sha512 --kickstart
|
||||
user --name=builder --plaintext --password builder --groups=builder,wheel
|
||||
|
||||
# Disable general install minutia
|
||||
firstboot --disabled
|
||||
eula --agreed
|
||||
|
||||
# Create a single partition with no swap space
|
||||
bootloader --location=mbr
|
||||
zerombr
|
||||
clearpart --all --initlabel
|
||||
part / --grow --asprimary --fstype=ext4 --label=slash
|
||||
|
||||
%packages --ignoremissing --excludedocs
|
||||
openssh-server
|
||||
sed
|
||||
sudo
|
||||
|
||||
# Remove unnecessary firmware
|
||||
-*-firmware
|
||||
|
||||
# Remove other unnecessary packages
|
||||
-postfix
|
||||
%end
|
||||
|
||||
# Enable/disable the following services
|
||||
services --enabled=sshd
|
||||
|
||||
# Perform a reboot once the installation has completed
|
||||
reboot
|
||||
|
||||
# The %post section is essentially a shell script
|
||||
%post --erroronfail
|
||||
|
||||
# Update the root certificates
|
||||
update-ca-trust force-enable
|
||||
|
||||
# Ensure that the "builder" user doesn't require a password to use sudo,
|
||||
# or else Ansible will fail
|
||||
echo 'builder ALL=(ALL) NOPASSWD: ALL' >/etc/sudoers.d/builder
|
||||
chmod 440 /etc/sudoers.d/builder
|
||||
|
||||
# Install open-vm-tools
|
||||
yum install -y open-vm-tools
|
||||
|
||||
# Remove the package cache
|
||||
yum -y clean all
|
||||
|
||||
# Disable swap
|
||||
swapoff -a
|
||||
rm -f /swapfile
|
||||
sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab
|
||||
|
||||
# Ensure on next boot that network devices get assigned unique IDs.
|
||||
sed -i '/^\(HWADDR\|UUID\)=/d' /etc/sysconfig/network-scripts/ifcfg-*
|
||||
|
||||
%end
|
75
packer/ova/linux/centos/http/8/ks.cfg
Normal file
75
packer/ova/linux/centos/http/8/ks.cfg
Normal file
@ -0,0 +1,75 @@
|
||||
# version=RHEL8
|
||||
# Install OS instead of upgrade
|
||||
install
|
||||
cdrom
|
||||
auth --enableshadow --passalgo=sha512 --kickstart
|
||||
# License agreement
|
||||
eula --agreed
|
||||
# Use text mode install
|
||||
text
|
||||
# Disable Initial Setup on first boot
|
||||
firstboot --disable
|
||||
# Keyboard layout
|
||||
keyboard --vckeymap=us --xlayouts='us'
|
||||
# System language
|
||||
lang en_US.UTF-8
|
||||
# Network information
|
||||
network --bootproto=dhcp --device=link --activate
|
||||
network --hostname=rhel8
|
||||
firewall --disabled
|
||||
# Root password
|
||||
rootpw builder --plaintext
|
||||
# SELinux configuration
|
||||
selinux --permissive
|
||||
# Do not configure the X Window System
|
||||
skipx
|
||||
# System timezone
|
||||
timezone UTC
|
||||
# Add a user named builder
|
||||
user --groups=wheel --name=builder --password=builder --plaintext --gecos="builder"
|
||||
|
||||
# System bootloader configuration
|
||||
bootloader --location=mbr --boot-drive=sda
|
||||
# Clear the Master Boot Record
|
||||
zerombr
|
||||
clearpart --all --initlabel --drives=sda
|
||||
part / --fstype="ext4" --grow --asprimary --label=slash --ondisk=sda
|
||||
|
||||
# Reboot after successful installation
|
||||
reboot
|
||||
|
||||
%packages --ignoremissing --excludedocs
|
||||
# dnf group info minimal-environment
|
||||
@^minimal-environment
|
||||
@core
|
||||
openssh-server
|
||||
sed
|
||||
sudo
|
||||
python3
|
||||
open-vm-tools
|
||||
|
||||
# Exclude unnecessary firmwares
|
||||
-iwl*firmware
|
||||
%end
|
||||
|
||||
# Enable/disable the following services
|
||||
services --enabled=sshd
|
||||
|
||||
%post --nochroot --logfile=/mnt/sysimage/root/ks-post.log
|
||||
# Disable quiet boot and splash screen
|
||||
sed --follow-symlinks -i "s/ rhgb quiet//" /mnt/sysimage/etc/default/grub
|
||||
sed --follow-symlinks -i "s/ rhgb quiet//" /mnt/sysimage/boot/grub2/grubenv
|
||||
|
||||
# Passwordless sudo for the user 'builder'
|
||||
echo "builder ALL=(ALL) NOPASSWD: ALL" >> /mnt/sysimage/etc/sudoers.d/builder
|
||||
# Remove the package cache
|
||||
yum -y clean all
|
||||
|
||||
# Disable swap
|
||||
swapoff -a
|
||||
rm -f /swapfile
|
||||
sed -ri '/\sswap\s/s/^#?/#/' /etc/fstab
|
||||
|
||||
sed -i '/^\(HWADDR\|UUID\)=/d' /etc/sysconfig/network-scripts/ifcfg-*
|
||||
|
||||
%end
|
Reference in New Issue
Block a user