Files
homelab/infra-config/04-vm-templates/ubuntu-24.04.03/http/user-data-v2
2025-09-21 18:42:01 -05:00

42 lines
1.3 KiB
Plaintext

#cloud-config
autoinstall:
version: 1
early-commands:
# Stop ssh for packer
- sudo systemctl stop ssh
locale: en_US
keyboard:
layout: us
identity:
hostname: ubuntu-server
username: wed
password: '$1$Cc71g3Aa$WUMTLZg7B94dhHdxT7J/P/'
ssh:
install-server: yes
allow-pw: yes
storage:
layout:
name: lvm
apt:
geoip: true
primary:
- arches: [i386, amd64]
uri: "http://archive.ubuntu.com/ubuntu"
# packages:
# - curl
# - unzip
# - openssh-server
# - util-linux-extra
# - qemu-guest-agent
# - cloud-init
user-data:
disable_root: false
late-commands:
- sed -i -e 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /target/etc/ssh/sshd_config
- sed -i -e 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /target/etc/ssh/sshd_config
- echo 'wed ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/wed
- curtin in-target --target=/target -- vmware-toolbox-cmd config set deployPkg enable-custom-scripts true
- curtin in-target --target=/target -- chmod 440 /etc/sudoers.d/wed
- curtin in-target --target=/target -- apt-get update
- curtin in-target --target=/target -- apt-get upgrade --yes