bootstrap: implement automated VM bootstrap mechanism for Phase 3 #7

Merged
torjus merged 1 commits from phase3-bootstrap-mechanism into master 2026-02-01 09:40:10 +00:00
Owner

Add systemd service that automatically bootstraps freshly deployed VMs
with their host-specific NixOS configuration from the flake repository.

Changes:

  • hosts/template2/bootstrap.nix: New systemd oneshot service that:

    • Runs after cloud-init completes (ensures hostname is set)
    • Reads hostname from hostnamectl (set by cloud-init from Terraform)
    • Checks network connectivity via HTTPS (curl)
    • Runs nixos-rebuild boot with flake URL
    • Reboots on success, fails gracefully with clear errors on failure
  • hosts/template2/configuration.nix: Configure cloud-init datasource

    • Changed from NoCloud to ConfigDrive (used by Proxmox)
    • Allows cloud-init to receive config from Proxmox
  • hosts/template2/default.nix: Import bootstrap.nix module

  • terraform/vms.tf: Add cloud-init disk to VMs

    • Configure disks.ide.ide2.cloudinit block
    • Removed invalid cloudinit_cdrom_storage parameter
    • Enables Proxmox to inject cloud-init configuration
  • TODO.md: Mark Phase 3 as completed

This eliminates the manual nixos-rebuild step from the deployment workflow.
VMs now automatically pull and apply their configuration on first boot.

Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com

Add systemd service that automatically bootstraps freshly deployed VMs with their host-specific NixOS configuration from the flake repository. Changes: - hosts/template2/bootstrap.nix: New systemd oneshot service that: - Runs after cloud-init completes (ensures hostname is set) - Reads hostname from hostnamectl (set by cloud-init from Terraform) - Checks network connectivity via HTTPS (curl) - Runs nixos-rebuild boot with flake URL - Reboots on success, fails gracefully with clear errors on failure - hosts/template2/configuration.nix: Configure cloud-init datasource - Changed from NoCloud to ConfigDrive (used by Proxmox) - Allows cloud-init to receive config from Proxmox - hosts/template2/default.nix: Import bootstrap.nix module - terraform/vms.tf: Add cloud-init disk to VMs - Configure disks.ide.ide2.cloudinit block - Removed invalid cloudinit_cdrom_storage parameter - Enables Proxmox to inject cloud-init configuration - TODO.md: Mark Phase 3 as completed This eliminates the manual nixos-rebuild step from the deployment workflow. VMs now automatically pull and apply their configuration on first boot. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
torjus added 1 commit 2026-02-01 09:39:23 +00:00
bootstrap: implement automated VM bootstrap mechanism for Phase 3
Some checks failed
Run nix flake check / flake-check (pull_request) Failing after 1m20s
Run nix flake check / flake-check (push) Failing after 1m54s
6f7aee3444
Add systemd service that automatically bootstraps freshly deployed VMs
with their host-specific NixOS configuration from the flake repository.

Changes:
- hosts/template2/bootstrap.nix: New systemd oneshot service that:
  - Runs after cloud-init completes (ensures hostname is set)
  - Reads hostname from hostnamectl (set by cloud-init from Terraform)
  - Checks network connectivity via HTTPS (curl)
  - Runs nixos-rebuild boot with flake URL
  - Reboots on success, fails gracefully with clear errors on failure

- hosts/template2/configuration.nix: Configure cloud-init datasource
  - Changed from NoCloud to ConfigDrive (used by Proxmox)
  - Allows cloud-init to receive config from Proxmox

- hosts/template2/default.nix: Import bootstrap.nix module

- terraform/vms.tf: Add cloud-init disk to VMs
  - Configure disks.ide.ide2.cloudinit block
  - Removed invalid cloudinit_cdrom_storage parameter
  - Enables Proxmox to inject cloud-init configuration

- TODO.md: Mark Phase 3 as completed

This eliminates the manual nixos-rebuild step from the deployment workflow.
VMs now automatically pull and apply their configuration on first boot.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
torjus merged commit c3180c1b2c into master 2026-02-01 09:40:10 +00:00
torjus deleted branch phase3-bootstrap-mechanism 2026-02-01 09:40:10 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: torjus/nixos-servers#7