ns2: migrate to OpenTofu management
Some checks failed
Run nix flake check / flake-check (push) Failing after 1s
Some checks failed
Run nix flake check / flake-check (push) Failing after 1s
- Remove hosts/template/ (legacy template1) and give each legacy host its own hardware-configuration.nix copy - Recreate ns2 using create-host with template2 base - Add secondary DNS services (NSD + Unbound resolver) - Configure Vault policy for shared DNS secrets - Fix create-host IP uniqueness validator to check CIDR notation (prevents false positives from DNS resolver entries) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -140,20 +140,22 @@ def validate_ip_unique(ip: Optional[str], repo_root: Path) -> None:
|
||||
ip_part = ip.split("/")[0]
|
||||
|
||||
# Check all hosts/*/configuration.nix files
|
||||
# Search for IP with CIDR notation to match static IP assignments
|
||||
# (e.g., "10.69.13.5/24") but not DNS resolver entries (e.g., "10.69.13.5")
|
||||
hosts_dir = repo_root / "hosts"
|
||||
if hosts_dir.exists():
|
||||
for config_file in hosts_dir.glob("*/configuration.nix"):
|
||||
content = config_file.read_text()
|
||||
if ip_part in content:
|
||||
if ip in content:
|
||||
raise ValueError(
|
||||
f"IP address {ip_part} already in use in {config_file}"
|
||||
)
|
||||
|
||||
# Check terraform/vms.tf
|
||||
# Check terraform/vms.tf - search for full IP with CIDR
|
||||
terraform_file = repo_root / "terraform" / "vms.tf"
|
||||
if terraform_file.exists():
|
||||
content = terraform_file.read_text()
|
||||
if ip_part in content:
|
||||
if ip in content:
|
||||
raise ValueError(
|
||||
f"IP address {ip_part} already in use in {terraform_file}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user