forked from David-VTUK/Rancher-Packer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript-longhorn.sh
32 lines (27 loc) · 959 Bytes
/
script-longhorn.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Apply updates and cleanup Apt cache
# packer build --var-file=variables.json ubuntu-2004.json
apt-get update ; apt-get -y dist-upgrade
apt-get -y autoremove
apt-get -y clean
apt-get install docker.io open-iscsi -y
# Disable swap - generally recommended for K8s, but otherwise enable it for other workloads
echo "Disabling Swap"
swapoff -a
sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab
# Reset the machine-id value. This has known to cause issues with DHCP
#
echo "Reset Machine-ID"
truncate -s 0 /etc/machine-id
rm /var/lib/dbus/machine-id
ln -s /etc/machine-id /var/lib/dbus/machine-id
# Reset any existing cloud-init state
#
echo "Reset Cloud-Init"
rm /etc/cloud/cloud.cfg.d/*.cfg
cloud-init clean -s -l
# Prevent cloud-init from setting IP
#
echo "Disabling cloud-init networking"
bash -c "echo 'network: {config: disabled}' > /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg"
echo "Removing existing Netplan config file"
rm /etc/netplan/*.yaml