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