--- - name: Update package cache for Debian hosts ansible.builtin.apt: update_cache: true when: - "'apt' in ansible_pkg_mgr" - name: Update package cache for RHEL/CentOS/Fedora hosts ansible.builtin.dnf: update_cache: true when: - "'dnf' in ansible_pkg_mgr" - ansible_distribution_major_version|int >= 8 - name: Update all host packages ansible.builtin.package: name=* state=latest ...