This commit is contained in:
karpenok committed 2026-11-08 11:36:41 +07:00
1 parent 00a0615750
commit 5f91f7bc95
6 files changed
+51 -21

No files matched your search

-18
View File
@@ -49,24 +49,6 @@ jobs:
chmod 600 "${HOME}/.ssh/id_ed25519"
cd "${HOME}/homelab-infra"
ansible-inventory -i inventories/prod/hosts.yml --list > /tmp/inventory.json
python3 - <<'PY'
import json, subprocess
data = json.load(open("/tmp/inventory.json"))
hosts = data.get("netbird", {}).get("hosts", [])
hostvars = data.get("_meta", {}).get("hostvars", {})
targets = []
for name in hosts:
address = hostvars.get(name, {}).get("ansible_host")
if not address:
raise SystemExit(f"У {name} нет ansible_host")
targets.append(address)
if not targets:
raise SystemExit("В группе netbird нет машин")
print("Цели из inventory:", ", ".join(targets))
for address in targets:
subprocess.check_call(["ssh-keyscan", "-H", address], stdout=open(f"{__import__('os').environ['HOME']}/.ssh/known_hosts", "a"))
PY
ansible-playbook playbooks/site.yml \
-i inventories/prod/hosts.yml \