Update ansible/update.yml

This commit is contained in:
2026-08-11 22:23:48 +02:00
parent cf0eabd109
commit 98962e288a

View File

@@ -37,16 +37,19 @@
# ========================================== # ==========================================
- name: Zbieranie faktów systemowych - name: Zbieranie faktów systemowych
ansible.builtin.setup: ansible.builtin.setup:
when: host_is_online when: host_is_online | default(false)
ignore_unreachable: true
ignore_errors: true
# ========================================== # ==========================================
# DEBIAN / UBUNTU # DEBIAN / UBUNTU
# ========================================== # ==========================================
- name: Aktualizacja pakietów (Debian/Ubuntu) - name: Aktualizacja pakietów (Debian/Ubuntu)
when: when:
- host_is_online - host_is_online | default(false)
- ansible_os_family | default('') == 'Debian' - ansible_os_family | default('') == 'Debian'
- not (skip_apt | default(false)) - not (skip_apt | default(false))
ignore_unreachable: true
block: block:
- name: Aktualizacja pamięci podręcznej i podniesienie pakietów - name: Aktualizacja pamięci podręcznej i podniesienie pakietów
ansible.builtin.apt: ansible.builtin.apt:
@@ -69,9 +72,10 @@
# ========================================== # ==========================================
- name: Aktualizacja pakietów (Alpine Linux) - name: Aktualizacja pakietów (Alpine Linux)
when: when:
- host_is_online - host_is_online | default(false)
- ansible_os_family | default('') == 'Alpine' - ansible_os_family | default('') == 'Alpine'
- not (skip_apt | default(false)) - not (skip_apt | default(false))
ignore_unreachable: true
block: block:
- name: Aktualizacja pamięci podręcznej i pakietów (apk) - name: Aktualizacja pamięci podręcznej i pakietów (apk)
community.general.apk: community.general.apk:
@@ -102,5 +106,5 @@
ansible.builtin.debug: ansible.builtin.debug:
msg: msg:
- "Host: {{ inventory_hostname }} ({{ ansible_distribution | default('Brak połączenia') }})" - "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 | default(false)) 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' }}"