Skip to content

Instantly share code, notes, and snippets.

@mkoert
Created February 12, 2026 20:50
Show Gist options
  • Select an option

  • Save mkoert/b1952f38424054be15bd56f03ea3b31d to your computer and use it in GitHub Desktop.

Select an option

Save mkoert/b1952f38424054be15bd56f03ea3b31d to your computer and use it in GitHub Desktop.
#cloud-config
system_info:
default_user:
name: <USERNAME>
plain_text_passwd: "<PASSWORD>"
lock_passwd: false
autoinstall:
version: 1
locale: en_US
keyboard:
layout: us
# variant: us
ssh:
install-server: true
allow-pw: true
# disable_root: true
ssh_quiet_keygen: true
allow_public_ssh_keys: true
packages:
- openssh-server
- open-vm-tools
- cloud-init
- qemu-guest-agent
storage:
layout:
name: direct
swap:
size: 0
user-data:
users:
- name: ubuntu
groups: [adm, sudo]
shell: /bin/bash
sudo: ALL=(ALL) NOPASSWD:ALL
# Replace this with your actual SSH public key content
ssh_authorized_keys:
- "<KEY GOES HERE>"
# Prevent interactive prompts during installation
apt:
conf: |
APT::Get::Assume-Yes "true";
APT::Get::Force-Yes "true";
Dpkg::Options "--force-confdef";
Dpkg::Options "--force-confold";
late-commands:
- echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/ubuntu
- chmod 440 /target/etc/sudoers.d/ubuntu
- echo 'DEBIAN_FRONTEND=noninteractive' >> /target/etc/environment
# Ensure cloud-init services are enabled
- systemctl enable cloud-init --root=/target
- systemctl enable cloud-init-local --root=/target
- systemctl enable cloud-config --root=/target
- systemctl enable cloud-final --root=/target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment