--- - name: Update and upgrade Raspberry Pi hosts: all become: yes tasks: - name: Update the APT package index apt: update_cache: yes - name: Upgrade all installed packages apt: upgrade: dist autoremove: yes autoclean: yes cache_valid_time: 3600 # Cache validity time in seconds #- name: Ensure that Raspberry Pi firmware is up to date # shell: sudo rpi-update # args: # creates: /boot/.firmware_up_to_date - name: Reboot if needed reboot: msg: "Rebooting the Raspberry Pi after update" reboot_timeout: 600 test_command: uptime