Skip to content

Instantly share code, notes, and snippets.

@tlhakhan
Last active June 30, 2023 02:39
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save tlhakhan/97ee4d9f22eed7530c4be339a80a6f68 to your computer and use it in GitHub Desktop.
Save tlhakhan/97ee4d9f22eed7530c4be339a80a6f68 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
- hostnamectl set-hostname ubuntu-00 # update hostname even for the installer environment
- dhclient # re-register the updated hostname
network:
version: 2
ethernets:
eth0:
dhcp4: yes
ssh:
install-server: yes
identity:
hostname: ubuntu-00 # hostname of the system
password: $6$jCfWFbdxh1lK09sY$pxFnrW/yXewYFmgoaywu3WKhdPQg0e8DR8jvedAV.udXM0.i5M6wr4Up2S7ZCN9kNDmg.s7fmrOaXE6nEyzPb/ # Welcome123
username: ubuntu # root doesn't work
storage:
layout:
name: lvm
packages:
- open-vm-tools # for vmware hypervisor
- ansible
- git
user-data:
disable_root: false
late-commands:
- echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' > /target/etc/sudoers.d/sysuser # allow sudo without password
- sed -ie 's/GRUB_CMDLINE_LINUX=.*/GRUB_CMDLINE_LINUX="net.ifnames=0 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