Skip to content

Instantly share code, notes, and snippets.

@jimangel
Created November 20, 2022 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimangel/82aa7fbf17da388b99dd989316620734 to your computer and use it in GitHub Desktop.
Save jimangel/82aa7fbf17da388b99dd989316620734 to your computer and use it in GitHub Desktop.
VMware ISO Ubuntu 22.04 LTS Autoinstall
#cloud-config
autoinstall:
version: 1
ssh:
install-server: true
# option "allow-pw" defaults to `true` if authorized_keys is empty, `false` otherwise.
allow-pw: false
# "[late-commands] are run in the installer environment with the installed system mounted at /target."
late-commands:
# randomly generate the hostname & show the IP at boot
- echo ubuntu-host-$(openssl rand -hex 3) > /target/etc/hostname
# dump the IP out at login screen
- echo "Ubuntu 22.04 LTS \nIP - $(hostname -I)\n" > /target/etc/issue
# storage was a pain in the ass and merged multiple things, I just want a 100% use of the fs. (alt option: https://gist.github.com/anedward01/b68e00bb2dcfa4f1335cd4590cbc8484#file-user-data-L97-L199)
- curtin in-target --target=/target -- lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
- curtin in-target --target=/target -- resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
# WARNING: if booting from iso is the default, you might get stuck in an infinate loop without the below (or good timing)
# shut-down the host to avoid an infinite installer loop
# - shutdown -h now
user-data:
disable_root: true
timezone: America/Chicago
package_upgrade: false
users:
- name: jangel
primary_group: users
groups: sudo
lock_passwd: true
# don't need PW since using SSH, leaving this in though...
# password is "changeme" - created with `docker run -it --rm alpine mkpasswd --method=SHA-512`
# passwd: "$5$IWwNqL9VUSDoc4Jv$DEUGR.cZQcbz/QvdCOmU13fX5ZW0rANg8LqkAtX3nBA"
shell: /bin/bash
# use cat ~/.ssh/id_rsa.pub or generate to get your public key
ssh_authorized_keys:
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDTK3YYoKho9SvTejt9430NRwu5ZQpwtAQGBbX8piLvLfsrJzzXxWljTvmC63VMAbCy3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55WF1OHkLIP3/7954/M22YJepXBnKZmkz7ZDF9aqP9UbMlb80vlbbDSIjCvpVNuT5VlLBNU9/WxUFRVM3TSK1HNkrZ7O6OIrzEZkQ== jangel@inwin-6x12-32gb-4650-1"
sudo: ALL=(ALL) NOPASSWD:ALL
# reboot after first host initial provisioning
power_state:
mode: reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment