From 39dca162efbc39a70ae097d2222488ab30fc21de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20=C5=BBbikowski?= Date: Tue, 11 Aug 2026 22:19:29 +0200 Subject: [PATCH] Update ansible/update.yml --- ansible/update.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ansible/update.yml b/ansible/update.yml index d6b42ab..cce3ad9 100644 --- a/ansible/update.yml +++ b/ansible/update.yml @@ -5,10 +5,16 @@ 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: + - 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 ansible.builtin.wait_for: host: "{{ ansible_host | default(inventory_hostname) }}" @@ -27,7 +33,7 @@ host_is_online: false # ========================================== - # ZBIERANIE FAKTÓW (tylko dla aktywnych hostów) + # POBRANIE FAKTÓW DLA AKTYWNYCH HOSTÓW # ========================================== - name: Zbieranie faktów systemowych ansible.builtin.setup: @@ -95,6 +101,6 @@ - name: Informacja o stanie po aktualizacji ansible.builtin.debug: 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 restartu: {{ '⚠️ WYMAGANY RESTART!' if (reboot_needed | default(false)) else '✅ Brak potrzeby restartu' }}" \ No newline at end of file