Write final static netplan during install

This commit is contained in:
Jino Jose 2026-06-25 06:15:04 +05:30
parent 01793ede4e
commit b9aa72f038

View File

@ -7,40 +7,23 @@ autoinstall:
keyboard: keyboard:
layout: us layout: us
# ── Network: apply known-good static defaults ─ # ── Network: keep installer boot simple; write final netplan ourselves ─
# We no longer pause on the installer network screen because Subiquity was # Subiquity was repeatedly bringing the target system up without the default
# accepting the IP but dropping the default gateway on console installs. # route, even when the static gateway was supplied. Use DHCP only for the
# Bring the VM up directly on the standard Cezen static network instead. # installer environment, then write the final static netplan file directly
# into the installed system in late-commands.
network: network:
network: network:
version: 2 version: 2
ethernets: ethernets:
any-en: any-en:
dhcp4: false dhcp4: true
match: match:
name: "en*" name: "en*"
addresses:
- 172.16.10.181/23
routes:
- to: default
via: 172.16.10.1
nameservers:
addresses:
- 8.8.8.8
- 1.1.1.1
any-eth: any-eth:
dhcp4: false dhcp4: true
match: match:
name: "eth*" name: "eth*"
addresses:
- 172.16.10.181/23
routes:
- to: default
via: 172.16.10.1
nameservers:
addresses:
- 8.8.8.8
- 1.1.1.1
# ── Storage: LVM using ALL disk space ───────── # ── Storage: LVM using ALL disk space ─────────
storage: storage:
@ -80,6 +63,27 @@ autoinstall:
- echo "cezen ALL=(ALL) NOPASSWD:ALL" > /target/etc/sudoers.d/cezen - echo "cezen ALL=(ALL) NOPASSWD:ALL" > /target/etc/sudoers.d/cezen
- chmod 440 /target/etc/sudoers.d/cezen - chmod 440 /target/etc/sudoers.d/cezen
# Replace the installer-generated network config with the final static
# Cezen network so the installed system always has the expected route.
- rm -f /target/etc/netplan/50-cloud-init.yaml /target/etc/netplan/00-installer-config.yaml || true
- |
cat > /target/etc/netplan/99-cezen-static.yaml << 'EOF'
network:
version: 2
ethernets:
ens18:
dhcp4: false
addresses:
- 172.16.10.181/23
routes:
- to: default
via: 172.16.10.1
nameservers:
addresses:
- 8.8.8.8
- 1.1.1.1
EOF
# Disable the installer media APT source so post-install apt uses network # Disable the installer media APT source so post-install apt uses network
# mirrors instead of the custom ISO content. # mirrors instead of the custom ISO content.
- sed -i 's/^deb cdrom:/# deb cdrom:/' /target/etc/apt/sources.list || true - sed -i 's/^deb cdrom:/# deb cdrom:/' /target/etc/apt/sources.list || true