aipackage/autoinstall/user-data
2026-06-25 09:15:15 +05:30

137 lines
4.6 KiB
Plaintext

#cloud-config
autoinstall:
version: 1
# ── Locale & keyboard ──────────────────────────
locale: en_IN.UTF-8
keyboard:
layout: us
# ── Network: keep installer boot simple; write final netplan ourselves ─
# Subiquity was repeatedly bringing the target system up without the default
# route, even when the static gateway was supplied. Use DHCP only for the
# installer environment, then write the final static netplan file directly
# into the installed system in late-commands.
network:
network:
version: 2
ethernets:
any-en:
dhcp4: true
match:
name: "en*"
any-eth:
dhcp4: true
match:
name: "eth*"
# ── Storage: LVM using ALL disk space ─────────
storage:
layout:
name: lvm
match:
size: largest
# ── Identity ──────────────────────────────────
identity:
hostname: cezenai
username: cezen
# Password: cezen@123
password: "$6$I5VA.42G1xTeVhCv$KCLzqIKg/kbNHZyiTEMAY4FZsJMDDwoS90k6Ffb9VEwmcK.wuzlJNe3ceiEfLrzYzXEvqjYsLc7klAbeGPGab."
# ── SSH ───────────────────────────────────────
ssh:
install-server: true
allow-pw: true
# ── Base packages ─────────────────────────────
packages:
- git
- curl
- wget
- python3
- whiptail
- avahi-daemon
- openssh-server
# ── Late commands ─────────────────────────────
late-commands:
# Extend LVM to use 100% of available disk space
- lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv || true
- resize2fs /dev/ubuntu-vg/ubuntu-lv || true
# Allow cezen passwordless sudo (needed for install.sh)
- echo "cezen ALL=(ALL) NOPASSWD:ALL" > /target/etc/sudoers.d/cezen
- chmod 440 /target/etc/sudoers.d/cezen
# Replace the installer-generated network config with a simple DHCP target
# config. The console wizard can later switch this to static if desired.
- rm -f /target/etc/netplan/50-cloud-init.yaml /target/etc/netplan/00-installer-config.yaml || true
- |
cat > /target/etc/netplan/99-cezen-dhcp.yaml << 'EOF'
network:
version: 2
ethernets:
any-en:
dhcp4: true
match:
name: "en*"
any-eth:
dhcp4: true
match:
name: "eth*"
EOF
# Disable the installer media APT source so post-install apt uses network
# mirrors instead of the custom ISO content.
- sed -i 's/^deb cdrom:/# deb cdrom:/' /target/etc/apt/sources.list || true
# Install the Cezen AI payload from the ISO first. Fall back to Git only
# when building from older media that does not contain /cdrom/cezen-aipackage.
- mkdir -p /target/opt/aipackage
- cp -a /cdrom/cezen-aipackage/. /target/opt/aipackage/ || git clone https://cgit.cezentech.com/jinojose/aipackage.git /target/opt/aipackage
# Deploy the console setup wizard
- mkdir -p /target/opt/cezen
- cp /target/opt/aipackage/autoinstall/firstboot-setup.sh /target/opt/cezen/firstboot-setup.sh
- chmod +x /target/opt/cezen/firstboot-setup.sh
# Set hostname to cezenai so it's reachable as cezenai.local via mDNS
- echo "cezenai" > /target/etc/hostname
- sed -i 's/aiserver/cezenai/g' /target/etc/hosts || true
# Create cezen-setup console UI systemd service on tty1
- |
cat > /target/etc/systemd/system/cezen-setup.service << 'EOF'
[Unit]
Description=Cezen AI Suite — Console Setup Wizard
After=network-online.target avahi-daemon.service
Wants=network-online.target
Before=getty@tty1.service
Conflicts=getty@tty1.service
ConditionPathExists=!/opt/cezen/.setup-done
[Service]
Type=simple
ExecStart=/opt/cezen/firstboot-setup.sh
StandardInput=tty
StandardOutput=tty
StandardError=tty
TTYPath=/dev/tty1
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
Restart=no
[Install]
WantedBy=multi-user.target
EOF
- curtin in-target -- systemctl enable ssh
- curtin in-target -- systemctl enable cezen-setup.service
- curtin in-target -- systemctl enable avahi-daemon.service
# ── Skip confirmations ─────────────────────────
user-data:
disable_root: false