Update ansible/update.yml
This commit is contained in:
@@ -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' }}"
|
||||
Reference in New Issue
Block a user