packer-templates/ubuntu/http/user-data
Tyler 870c913711
Some checks reported errors
continuous-integration/drone/push Build was killed
Improve performance, add additional ram, improve Ubuntu user-data (and fix 22.04)
2023-06-03 23:54:32 -04:00

31 lines
1.4 KiB
Plaintext

#cloud-config
autoinstall:
version: 1
identity:
hostname: ubuntu-server
password: '$6$wdAcoXrU039hKYPd$508Qvbe7ObUnxoj15DRCkzC3qO7edjH0VV7BPNRDYK4QR8ofJaEEF2heacn0QgD.f8pO8SNp83XNdWG6tocBM1'
username: ubuntu
early-commands:
# otherwise packer tries to connect and exceed max attempts:
- systemctl stop ssh
ssh:
install-server: true
allow-pw: yes
late-commands:
- |
curtin in-target --target=/target -- /bin/bash -c ' \
sed -ie "s/^[#\s]*UseDNS.*$/UseDNS no/g" /etc/ssh/sshd_config; \
ssh-keygen -A; \
systemctl enable ssh.service; \
sed -ie "s/^GRUB_DEFAULT=.*/GRUB_DEFAULT=\"0\"/g" /etc/default/grub; \
sed -ie "s/^GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX=\"net.ifnames=0 biosdevname=0 systemd.unified_cgroup_hierarchy=0\"/g" /etc/default/grub; \
sed -ie "s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=\"net.ifnames=0 biosdevname=0 systemd.unified_cgroup_hierarchy=0\"/g" /etc/default/grub; \
update-grub; \
update-initramfs -c -k all; \
apt-get -y purge snapd; \
systemctl disable apt-daily.service; \
systemctl disable apt-daily.timer; \
systemctl disable apt-daily-upgrade.service; \
systemctl disable apt-daily-upgrade.timer; \
exit 0 \
'