diff --git a/README.md b/README.md index 64d72fd..d80760a 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ sudo bash install.sh Server reboots automatically after NVIDIA drivers install. Phase 2 runs on its own after reboot. +On the custom ISO, Ubuntu autoinstall now pauses on the installer network screen so the operator can choose the final IP address from the VM console before installation continues. + ## What Gets Installed (Entry Tier) | Service | Port | Notes | diff --git a/autoinstall/user-data b/autoinstall/user-data index b847ece..aef7e99 100644 --- a/autoinstall/user-data +++ b/autoinstall/user-data @@ -1,14 +1,18 @@ #cloud-config autoinstall: version: 1 + interactive-sections: + - network # ── Locale & keyboard ────────────────────────── locale: en_IN.UTF-8 keyboard: layout: us - # ── Network: DHCP on first ethernet ─────────── - # Final network config is set by the web setup UI (browser on port 80) + # ── Network: stop on installer network screen ─ + # Subiquity will show the network UI and use the values below as defaults. + # This lets the operator set the final static IP from the VM console before + # installation completes. network: network: version: 2 diff --git a/autoinstall/websetup/server.py b/autoinstall/websetup/server.py index b35558a..ee99b0e 100644 --- a/autoinstall/websetup/server.py +++ b/autoinstall/websetup/server.py @@ -58,6 +58,19 @@ def validate_static_network(ip, prefix, gateway, dns): raise ValueError("CIDR prefix must be between 1 and 32") return str(prefix_int) +def is_ip_in_use(ip): + """Best-effort conflict check before taking a static IP.""" + try: + result = subprocess.run( + ["ping", "-c", "1", "-W", "1", ip], + stdout=subprocess.DEVNULL, + stderr=subprocess.DEVNULL, + check=False, + ) + return result.returncode == 0 + except Exception: + return False + def apply_static_ip(iface, ip, prefix, gateway, dns): prefix = validate_static_network(ip, prefix, gateway, dns) config = f"""network: @@ -270,6 +283,9 @@ HTML = r"""