Last active
December 29, 2021 08:52
-
-
Save sasaken555/ff9398c58643833341b41afb0851a1fc to your computer and use it in GitHub Desktop.
Ubuntu autoinstall config
This file contains 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
#!/bin/bash | |
# config files (user-data & meta-data) must be under "template" directory!! | |
OUTPUT_NAME=seed-$1 | |
VM_HOST_NAME=$1 | |
VM_IPV4_ADDRESS=$2 | |
rm -rf $VM_HOST_NAME | |
rm -f $OUTPUT_NAME.iso | |
cp -R template $VM_HOST_NAME | |
rm -f $VM_HOST_NAME/user-data | |
cat template/user-data \ | |
| sed "s/__HOST_NAME__/$VM_HOST_NAME/" \ | |
| sed "s/__IPV4_ADDRESS__/$VM_IPV4_ADDRESS/" \ | |
> $VM_HOST_NAME/user-data | |
hdiutil makehybrid -o $OUTPUT_NAME.iso \ | |
-hfs \ | |
-joliet \ | |
-iso \ | |
-default-volume-name cidata \ | |
$VM_HOST_NAME |
This file contains 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 | |
locale: ja_JP.UTF-8 | |
keyboard: | |
layout: "jp" | |
storage: | |
layout: | |
name: lvm | |
identity: | |
hostname: __HOST_NAME__ | |
username: ubuntu | |
password: __CRYPTED_PASSWORD__ | |
ssh: | |
install-server: true | |
allow-pw: false | |
authorized-keys: | |
- __SSH_PUBLIC_KEY__ | |
packages: | |
- open-iscsi | |
- nfs-common | |
late-commands: | |
- | | |
cat <<EOF | sudo tee /target/etc/netplan/90-network.yaml | |
network: | |
version: 2 | |
ethernets: | |
ens160: | |
dhcp4: false | |
dhcp6: false | |
addresses: | |
- "__IPV4_ADDRESS__/24" | |
gateway4: __GATEWAY_IPV4_ADDRESS__ | |
nameservers: | |
addresses: | |
- "8.8.8.8" | |
- "8.8.4.4" | |
EOF | |
- curtin in-target --target=/target -- netplan apply | |
user-data: | |
timezone: Asia/Tokyo | |
package_upgrade: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment