-
-
Save Tualua/94d106fdc762b9653ad0701f085884ca to your computer and use it in GitHub Desktop.
Ubuntu 20.04 autoinstall (casper/subiquity/curtin) to iPXE - work-in-progress (not fully working for iSCSI)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:ubuntu-autoinstall | |
echo Starting Ubuntu ${ubuntu-version} ${archl} autoinstaller for ${initiator-iqn} | |
sanhook ${base-iscsi}:${hostname}.boot.ubuntu || sleep 1 | |
#sanhook ${base-iscsi}:${hostname}.boot.ubuntu && set ubuntu-cc-iscsi storage: { layout: { name: lvm }, config: [{type: disk, path: ${base-iscsi}:${hostname}.boot.ubuntu }] } || sleep 1 | |
#sanhook ${base-iscsi}:${hostname}.boot.ubuntu && set ubuntu-iscsi ISCSI_INITIATOR=${initiator-iqn} ISCSI_TARGET_NAME=${base-iqn}:${hostname}.boot.ubuntu ISCSI_TARGET_IP=${iscsi-server} ISCSI_TARGET_PORT=3260 || sleep 1 | |
# https://medium.com/@tlhakhan/ubuntu-server-20-04-autoinstall-2e5f772b655a | |
# https://ubuntu.com/server/docs/install/autoinstall | |
# https://github.com/canonical/cloud-init/blob/master/doc/examples/kernel-cmdline.txt | |
# https://matt.olan.me/raspberry-pi-iscsi-root-on-ubuntu-20-04/ | |
# https://askubuntu.com/questions/1235723/automated-20-04-server-installation-using-pxe-and-live-server-image | |
# casper NFS config: nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>] | |
set ubuntu-installer-base ubuntu-${ubuntu-version}-live-server-${archl} | |
set base-url ubuntu/${ubuntu-installer-base}/ | |
kernel ${base-url}casper/vmlinuz | |
initrd ${base-url}casper/initrd | |
# h=${hostname};i=i-${uuid}; | |
# , ${ubuntu-cc-iscsi} | |
# ${ubuntu-iscsi} | |
imgargs vmlinuz initrd=initrd \ | |
ip=dhcp \ | |
url=${sanboot-url}ubuntu/${ubuntu-installer-base}.iso \ | |
autoinstall \ | |
ds=nocloud-net;s=${sanboot-url}ubuntu/autoinstall-${ubuntu-installer-base}/ \ | |
cc: autoinstall: { identity: { hostname: ${hostname} } } | |
# disk-detect/ibft/enable=true partman-iscsi/iscsi_auto=true \ | |
# netboot=nfs \ | |
# nfsroot=${nfs-server}:${nfs-root}${base-url} \ | |
# net.ifnames=0 \ | |
# biosdevname=0 \ | |
# ipv6.disable=1 \ | |
boot || goto failed | |
goto start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
autoinstall: | |
version: 1 | |
interactive-sections: | |
- network | |
- storage | |
early-commands: | |
- [/sbin/modprobe, iscsi_ibft] | |
- | | |
test ! -z /sys/firmware/ibft/initiator/initiator-name \ | |
&& sed -ie "s/InitiatorName=.*/InitiatorName=$(cat /sys/firmware/ibft/initiator/initiator-name)/" /etc/iscsi/initiatorname.iscsi \ | |
&& touch /etc/iscsi/iscsi.initramfs \ | |
&& /usr/sbin/iscsistart -b \ | |
|| /bin/true | |
locale: en_US.UTF-8 | |
refresh-installer: | |
update: no | |
keyboard: | |
layout: "no" | |
apt: | |
geoip: true | |
preserve_sources_list: false | |
primary: | |
- arches: | |
- amd64 | |
- i386 | |
uri: http://no.archive.ubuntu.com/ubuntu | |
- arches: | |
- default | |
uri: http://ports.ubuntu.com/ubuntu-ports | |
storage: | |
layout: | |
name: lvm | |
identity: | |
#hostname: ubuntu-server # must be commented out for ipxe setting to win out | |
password: $6$14qo8c1...z1rA4CWSi. | |
realname: Robin Smidsrød | |
username: robin | |
ssh: | |
install-server: true | |
allow-pw: true | |
authorized-keys: | |
- "ssh-ed25519 AAAAC...mRBlzLtA robin...639 # ssh-import-id gh:robinsmidsrod" | |
packages: | |
- joe | |
late-commands: | |
# Sets iSCSI Initiator IQN from iBFT and enables iSCSI boot in initrd | |
- | | |
test ! -z /sys/firmware/ibft/initiator/initiator-name \ | |
&& sed -ie "s/InitiatorName=.*/InitiatorName=$(cat /sys/firmware/ibft/initiator/initiator-name)/" /target/etc/iscsi/initiatorname.iscsi \ | |
&& touch /target/etc/iscsi/iscsi.initramfs \ | |
&& curtin in-target -- iscsiadm -m node --op=update -n node.startup -v automatic \ | |
&& curtin in-target -- systemctl enable open-iscsi \ | |
&& curtin in-target -- update-initramfs -v -k $(uname -r) -c \ | |
&& curtin in-target -- update-grub2 \ | |
|| /bin/true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment