packer-templates/ubuntu/http/user-data

31 lines
1.4 KiB
Plaintext
Raw Normal View History

2022-03-06 20:30:05 +00:00
#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 \
'