--- - name: Update and upgrade packages ansible.builtin.apt: update_cache: true upgrade: true autoremove: true - name: Check if reboot required ansible.builtin.stat: path: /var/run/reboot-required register: reboot_required_file - name: Reboot if required ansible.builtin.reboot: msg: Rebooting due to a kernel update when: reboot_required_file.stat.exists - name: Disable cron e-mail notifications ansible.builtin.cron: name: MAILTO user: root env: true job: ""