Update ansible/update.yml

This commit is contained in:
2026-08-11 22:19:29 +02:00
parent 11697fe3ce
commit 39dca162ef

View File

@@ -5,10 +5,16 @@
tasks: tasks:
# ========================================== # ==========================================
# BEZBŁĘDNE SPRAWDZENIE CZY HOST JEST WŁĄCZONY # SPRAWDZENIE DOSTĘPNOŚCI (PING + SSH)
# ========================================== # ==========================================
- name: Próba połączenia SSH (check online status) - name: Weryfikacja dostępności hosta
block: block:
- name: Sprawdzenie odpowiedzi ICMP Ping
ansible.builtin.command:
cmd: "ping -c 1 -W 2 {{ ansible_host | default(inventory_hostname) }}"
delegate_to: localhost
changed_when: false
- name: Sprawdzenie portu SSH - name: Sprawdzenie portu SSH
ansible.builtin.wait_for: ansible.builtin.wait_for:
host: "{{ ansible_host | default(inventory_hostname) }}" host: "{{ ansible_host | default(inventory_hostname) }}"
@@ -27,7 +33,7 @@
host_is_online: false host_is_online: false
# ========================================== # ==========================================
# ZBIERANIE FAKTÓW (tylko dla aktywnych hostów) # POBRANIE FAKTÓW DLA AKTYWNYCH HOSTÓW
# ========================================== # ==========================================
- name: Zbieranie faktów systemowych - name: Zbieranie faktów systemowych
ansible.builtin.setup: ansible.builtin.setup:
@@ -95,6 +101,6 @@
- name: Informacja o stanie po aktualizacji - name: Informacja o stanie po aktualizacji
ansible.builtin.debug: ansible.builtin.debug:
msg: msg:
- "Host: {{ inventory_hostname }} ({{ ansible_distribution | default('Nieokreślony') }})" - "Host: {{ inventory_hostname }} ({{ ansible_distribution | default('Brak połączenia') }})"
- "Status: {{ '🔴 NIEOSIĄGALNY / WYŁĄCZONY' if not host_is_online else ('⏭️ POMINIĘTO (skip_apt)' if (skip_apt | default(false)) else '✅ ZAKOŃCZONO SUCCESS') }}" - "Status: {{ '🔴 NIEOSIĄGALNY / WYŁĄCZONY' if not host_is_online else ('⏭️ POMINIĘTO (skip_apt)' if (skip_apt | default(false)) else '✅ ZAKOŃCZONO SUCCESS') }}"
- "Status restartu: {{ '⚠️ WYMAGANY RESTART!' if (reboot_needed | default(false)) else '✅ Brak potrzeby restartu' }}" - "Status restartu: {{ '⚠️ WYMAGANY RESTART!' if (reboot_needed | default(false)) else '✅ Brak potrzeby restartu' }}"