Files
ansible/templates/fleet_report.j2
2026-07-12 08:44:40 +02:00

34 lines
1.1 KiB
Django/Jinja

Raport stanu floty — {{ ansible_date_time.iso8601 }}
{{ '=' * 60 }}
{% set reported_hosts = hostvars | dict2items | selectattr('value.host_report', 'defined') | map(attribute='key') | sort %}
{% set reboot_hosts = [] %}
{% for h in reported_hosts %}
{% if hostvars[h].host_report.reboot_required %}
{% set _ = reboot_hosts.append(h) %}
{% endif %}
{% endfor %}
Hosty ({{ reported_hosts | length }}):
{% for h in reported_hosts %}
{% set r = hostvars[h].host_report %}
- {{ h }}
OS: {{ r.os }}
Uptime: {{ r.uptime_days }} dni
Dysk / zajęty: {{ r.disk_root_percent }}%
Aktualizacje: {{ r.upgradable_packages }} oczekujących
Reboot wymagany: {{ 'TAK' if r.reboot_required else 'nie' }}
{% endfor %}
{{ '=' * 60 }}
{% if reboot_hosts | length > 0 %}
UWAGA — hosty wymagające ręcznego restartu ({{ reboot_hosts | length }}):
{% for h in reboot_hosts %}
- {{ h }}
{% endfor %}
Reboot NIE jest wykonywany automatycznie — zrestartuj te hosty ręcznie,
gdy będzie to bezpieczne (patrz grupy Type-HOST / Type-VM / Type-CT).
{% else %}
Żaden host nie wymaga restartu.
{% endif %}