A new or rebuilt server should come up as NixOS without a manual install. cloud-init now runs a pinned nixos-infect on the Debian image and reboots into a bare NixOS; the system itself comes from nixos/. One template replaces the two near-identical Debian cloud-init files. nixos-infect's output needs three corrections on NixOS 26.05, written to bootstrap.nix: the takeover of the old root only exists in the scripted initrd, the IPv4 default route is never added without an interface, and the private network gets no route. Found and verified on throwaway servers. The servers still ignore changes to user_data, so nothing happens to the running ones. The new user_data output feeds a rebuild in place. Switch to OpenTofu: same HCL and state, and it is free software in nixpkgs. Commit the provider lock file so everyone gets the same providers. Assisted-by: Claude:fable-5-2
37 lines
928 B
HCL
37 lines
928 B
HCL
# Server IPs
|
|
output "ops_ipv4" {
|
|
value = hcloud_server.ops.ipv4_address
|
|
description = "Ops server IPv4"
|
|
}
|
|
|
|
output "ops_ipv6" {
|
|
value = hcloud_server.ops.ipv6_address
|
|
description = "Ops server IPv6"
|
|
}
|
|
|
|
output "services_ipv4" {
|
|
value = hcloud_server.services.ipv4_address
|
|
description = "Services server IPv4"
|
|
}
|
|
|
|
output "services_ipv6" {
|
|
value = hcloud_server.services.ipv6_address
|
|
description = "Services server IPv6"
|
|
}
|
|
|
|
# VPC Network
|
|
output "vpc_network" {
|
|
value = {
|
|
id = hcloud_network.main.id
|
|
ip_range = hcloud_network.main.ip_range
|
|
}
|
|
description = "VPC network info"
|
|
}
|
|
|
|
# For a rebuild in place:
|
|
# tofu output -json user_data | jq -r '."asxpio-ops"' |
|
|
# hcloud server rebuild --image debian-13 --user-data-from-file - asxpio-ops
|
|
output "user_data" {
|
|
value = local.user_data
|
|
description = "cloud-init per server, as a new or rebuilt server gets it"
|
|
}
|