Add ansible and playbook to trigger upgrade
Some checks failed
Run nix flake check / flake-check (push) Failing after 27m26s
Periodic flake update / flake-update (push) Successful in 1m24s

This commit is contained in:
2025-02-07 00:28:05 +01:00
parent fbcb81291b
commit 002f934c70
4 changed files with 60 additions and 0 deletions

31
inventory Executable file
View File

@@ -0,0 +1,31 @@
#!/usr/bin/env python
import json
import subprocess
IGNORED_HOSTS = [
"inc1",
"inc2",
"media1",
"nixos-test1",
"ns3",
"ns4",
"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))