--- ########################################################################### # # This role will update the package cache on the target host. # # This role should work on both Ubuntu and CentOS based hosts. # ########################################################################### # # NOTE: # The following variable(s) must be specified in the calling playbook (usually # done by doing a 'gather_facts' action); # # {{ ansible_distribution }} # ########################################################################### # tasks file for update_cache - debug: msg="Updating package cache" - name: updated package cache (Ubuntu) apt: update-cache: true when: ansible_distribution == "Ubuntu" or ansible_distribution == "Pop!_OS" or ansible_distribution == "Linux Mint" - name: update package cache (CentOS) yum: update_cache: true when: ansible_distribution == "CentOS" # EOF