Files
nixos-servers/inventory
Torjus Håkestad 0ef63ad874
Some checks failed
Run nix flake check / flake-check (push) Failing after 4m47s
Run nix flake check / flake-check (pull_request) Successful in 3m20s
hosts: remove decommissioned media1, ns3, ns4, nixos-test1
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 01:36:57 +01:00

28 lines
563 B
Python
Executable File

#!/usr/bin/env python
import json
import subprocess
IGNORED_HOSTS = [
"inc1",
"inc2",
"template1",
]
result = subprocess.run(["nix", "flake", "show", "--json"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
results = json.loads(result.stdout)
configs = results.get("nixosConfigurations")
hosts = [x for x in configs.keys() if x not in IGNORED_HOSTS]
output = {
"all": {
"hosts": hosts,
"vars": {
"ansible_python_interpreter": "/run/current-system/sw/bin/python3"
},
}
}
print(json.dumps(output))