--- - name: Prepare hosts: all tasks: - name: Ensure apt cache is updated apt: update_cache: true when: ansible_pkg_mgr == 'apt'