Skip to content

Instantly share code, notes, and snippets.

@reavon
Forked from tlhakhan/user-data.yml
Last active April 10, 2023 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save reavon/13c6d8b4509b7e8f7e4df9ad2fe427ea to your computer and use it in GitHub Desktop.
Save reavon/13c6d8b4509b7e8f7e4df9ad2fe427ea to your computer and use it in GitHub Desktop.
Ubuntu 20.04 example autoinstall user-data file
#cloud-config
autoinstall:
version: 1
early-commands:
- systemctl stop ssh # otherwise packer tries to connect and exceed max attempts
network:
network:
version: 2
ethernets:
eth0:
dhcp4: yes
dhcp-identifier: mac
apt:
preserve_sources_list: false
primary:
- arches: [amd64]
uri: "http://archive.ubuntu.com/ubuntu/"
ssh:
install-server: yes
authorized-keys:
- "your SSH pub key here"
allow-pw: no
identity:
hostname: ubuntu-00
password: "$6$FhcddHFVZ7ABA4Gi$9l4yURWASWe8xEa1jzI0bacVLvhe3Yn4/G3AnU11K3X0yu/mICVRxfo6tZTB2noKljlIRzjkVZPocdf63MtzC0" # root
username: ubuntu # root doesn't work
packages:
- open-vm-tools
user-data:
disable_root: false
late-commands:
- echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/ubuntu
- sed -ie 's/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX="net.ifnames=0 ipv6.disable=1 biosdevname=0"/' /target/etc/default/grub
- curtin in-target --target /target update-grub2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment