---
- name: Clean DNF cache
become: true
when: ansible_distribution == "Fedora" or (ansible_distribution == "CentOS" and ansible_distribution_major_version == "8")
shell:
cmd: dnf clean all
warn: false
- name: Clean YUM cache
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7"
cmd: yum clean all