provisioning-agent/README.md
Thomas Stallinger 8382a0a949 feat: initial Provisioning Agent (check-in loop + ansible-pull)
Erste lauffaehige Version: laedt Credentials, meldet sich per Bearer-Token
bei anode/api/v1/agent/checkin, wendet zugewiesene Blueprints per
ansible-pull an und schlaeft bis zum naechsten Intervall.
2026-08-01 15:55:26 +02:00

53 lines
1.7 KiB
Markdown

# provisioning-agent
Der Tuxflotte Provisioning Agent läuft auf installierten Geräten, meldet sich in regelmäßigen Abständen bei `anode` und wendet die ihm zugewiesenen Ansible-Rollen per `ansible-pull` an (siehe `ansible-content/`).
**Stand:** erste lauffähige Version. Die Einrichtung vor dem ersten Reboot (`backend_postinstall()`) ist noch nicht angebunden — Bootstrap läuft aktuell über den Dev-Endpoint `POST /api/v1/agent/bootstrap`.
## Manuelle Installation (Testgerät)
Voraussetzung: `ansible-core` ist installiert (`ansible-pull` im PATH).
1. Gerät aktivieren und Bereitstellungsvorlage zuweisen (bestehender Provisioning-Flow, siehe `provisioning-server`)
2. Agent-Secret erzeugen:
```
curl -X POST https://anode.tuxflotte.de/api/v1/agent/bootstrap \
-H "Content-Type: application/json" \
-d '{"device_id": "<device-uuid>"}'
```
3. Credentials ablegen:
```
install -d -m 0700 /etc/tuxflotte
cat > /etc/tuxflotte/agent.credentials <<EOF
{"device_id": "<device-uuid>", "agent_secret": "<agent-secret aus Schritt 2>"}
EOF
chmod 0600 /etc/tuxflotte/agent.credentials
```
4. Agent-Code ablegen und Dienst einrichten:
```
install -d /opt/tuxflotte/agent
cp agent.py /opt/tuxflotte/agent/
cp tuxflotte-agent.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable --now tuxflotte-agent
```
5. Prüfen:
```
journalctl -u tuxflotte-agent -f
ls /run/tuxflotte/agent/applied/
```
## Konfiguration
| Umgebungsvariable | Zweck | Default |
|---|---|---|
| `TUXFLOTTE_ANODE_URL` | Basis-URL des Provisioning-Servers | `https://anode.tuxflotte.de` |
| `TUXFLOTTE_AGENT_CREDENTIALS` | Pfad zur Credentials-Datei | `/etc/tuxflotte/agent.credentials` |