Skip to content

Instantly share code, notes, and snippets.

@zhouqt
Created January 27, 2021 18:47
Show Gist options
  • Save zhouqt/00c20af96b808752ceaa95a4ee0b76ea to your computer and use it in GitHub Desktop.
Save zhouqt/00c20af96b808752ceaa95a4ee0b76ea to your computer and use it in GitHub Desktop.
ubuntu subiquity autoinstall user-data example
#cloud-config
autoinstall:
version: 1
early-commands:
- snap set system proxy.http="http://192.168.122.1:12345"
- snap set system proxy.https="http://192.168.122.1:12345"
locale: en_US
keyboard:
layout: en
variant: us
network:
network:
version: 2
ethernets:
enp1s0:
dhcp4: yes
apt:
# even set to no/false, geoip lookup still happens
geoip: false
primary:
- arches: [default]
uri: "http://mirrors.aliyun.com/ubuntu/"
storage:
layout:
name: lvm
refresh-installer:
channel: edge
update: yes
identity:
hostname: server
# User creation doesn't work on ubuntu 20.04 cdrom, when using seed iso/disk datasource, but nocloud-net works.
# https://bugs.launchpad.net/ubuntu/+source/subiquity/+bug/1879485
username: test1
password: "$6$An3m6PIeRT.rNozT$kk8h3G8NOtllb18pq0iEa5a/T.6CEkR.Ta6uINh66HcS7YebUMkLVXaY5fGov1aWWt0ZFgyY.6fqrtNBDuEJt1"
ssh:
install-server: yes
allow-pw: yes
late-commands:
# From https://stackoverflow.com/a/61844775
- useradd -m -R /target -u 1001 test1
- echo "test1:ubuntu" | chroot /target /usr/sbin/chpasswd
- usermod -R /target -aG sudo test1
# Pause for debug.
- mkfifo /tmp/fifo1; read < /tmp/fifo1; pwd
user-data:
disable_root: false
# Below setting doesn't work now.
users:
- default
- name: test1
passwd: "$6$An3m6PIeRT.rNozT$kk8h3G8NOtllb18pq0iEa5a/T.6CEkR.Ta6uINh66HcS7YebUMkLVXaY5fGov1aWWt0ZFgyY.6fqrtNBDuEJt1"
lock_passwd: false
ssh_import_id: gh:zhouqt
ssh_pwauth: True
chpasswd: { expire: False }
sudo: ALL=(ALL) NOPASSWD:ALL
groups: users, admin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment