61 lines
1.6 KiB
Django/Jinja
Executable File
61 lines
1.6 KiB
Django/Jinja
Executable File
#% if bootstrap_distribution == 'k0s' %#
|
|
#!/usr/bin/env bash
|
|
|
|
[ $(id -u) -eq 0 ] || exec sudo $0 $@
|
|
|
|
# Prepare
|
|
sudo apt-get update -y
|
|
|
|
# Timezone
|
|
timedatectl set-timezone "#{ bootstrap_timezone }#"
|
|
|
|
# Install Packages
|
|
apt-get install -y --no-install-recommends \
|
|
apt-transport-https ca-certificates conntrack curl dirmngr gdisk gnupg hdparm htop \
|
|
iptables iputils-ping ipvsadm libseccomp2 lm-sensors neofetch net-tools nfs-common \
|
|
nvme-cli open-iscsi parted psmisc python3 python3-apt python3-kubernetes python3-yaml \
|
|
smartmontools socat software-properties-common unzip util-linux
|
|
|
|
# Update DNS
|
|
chattr -i /etc/resolv.conf
|
|
rm -f /etc/resolv.conf
|
|
cat <<EOF > /etc/resolv.conf
|
|
search .
|
|
nameserver #{ bootstrap_dns_server | default('1.1.1.1', true) }#
|
|
EOF
|
|
chattr +i /etc/resolv.conf
|
|
|
|
# Kernel Modules
|
|
for module in br_netfilter ceph ip_vs ip_vs_rr nbd overlay rbd; do
|
|
if ! test -f /etc/modules-load.d/$module.conf; then
|
|
echo $module > /etc/modules-load.d/$module.conf
|
|
fi
|
|
done
|
|
systemctl restart systemd-modules-load.service
|
|
|
|
# Sysctls
|
|
cat <<EOF > /etc/sysctl.d/99-kubernetes.conf
|
|
fs.inotify.max_queued_events: 65536
|
|
fs.inotify.max_user_watches: 524288
|
|
fs.inotify.max_user_instances: 8192
|
|
EOF
|
|
sysctl -p /etc/sysctl.d/99-kubernetes.conf
|
|
|
|
# Disable swap
|
|
swapoff -a
|
|
|
|
# Disable AppArmor
|
|
if systemctl is-enabled apparmor.service; then
|
|
systemctl mask apparmor.service
|
|
fi
|
|
|
|
# Neofetch
|
|
cat <<EOF > /etc/profile.d/neofetch.sh
|
|
neofetch --config none
|
|
EOF
|
|
chmod 755 /etc/profile.d/neofetch.sh
|
|
|
|
# Ensure k0s containerd directory exists
|
|
mkdir -p /etc/k0s/containerd.d
|
|
#% endif %#
|