--- - name: Update and Upgrade All Nodes hosts: all_nodes gather_facts: yes become: yes tasks: - name: Run apt update and apt upgrade ansible.builtin.apt: upgrade: dist update_cache: yes autoremove: yes autoclean: yes when: ansible_os_family == "Debian" - name: Check if a reboot is required ansible.builtin.stat: path: /var/run/reboot-required register: reboot_required_file - name: Reboot the server if required (VMs only) ansible.builtin.reboot: msg: "Reboot initiated by Ansible due to kernel updates" connect_timeout: 5 reboot_timeout: 300 pre_reboot_delay: 0 post_reboot_delay: 30 test_command: whoami when: - reboot_required_file.stat.exists - "'physical_iron' not in group_names" # Verhindert, dass Proxmox-Nodes ungeplant neustarten