--- - hosts: all become: true tasks: - name: Update all servers become: true apt: upgrade: dist update_cache: yes - name: Make sure Zypper is installed ansible.builtin.apt: name: "zypper" state: installed - name: See if pct needs a reboot ansible.builtin.shell: "needs-restarting -r > /dev/null; echo $?" register: needsRestarting - name: debug ansible.builtin.apt: msg: "{{ needsRestarting }}" - name: Reboot the Container ansible.builtin.reboot: reboot_timeout: 600 when: needsRestarting.stdout == "1"