--- - name: Update repositories cache apt: update_cache: yes - name: Stop service docker service: name: docker state: stopped when: docker_stopped - name: Upgrade all packages to the latest version apt: name: "*" state: latest - name: Remove useless packages from the cache apt: autoclean: yes - name: Remove dependencies that are no longer required apt: autoremove: yes - name: Reboot system shell: "sleep 5 && reboot" async: 1 poll: 0 - name: Wait for the reboot to complete wait_for_connection: connect_timeout: 20 sleep: 5 delay: 5 timeout: 300