--- ########################################################################### # # This role will apply available package upgrades to the target host. # # The 'update_cache' role should be run before running this role. # ########################################################################### # tasks file for upgrade_pkgs - debug: msg="Applying package updates" - name: Upgraded packages (Debian based distros) apt: name: "*" state: latest when: ansible_os_family == "Debian" - name: Clean up the autoremove packages (Debian based distros) apt: autoremove: true purge: true when: ansible_os_family == "Debian" - name: Clean up any packages left in the 'rc' state (Debian based distros) shell: cmd: /usr/bin/apt -y --purge remove $(dpkg -l | grep "^rc " | sed 's/ \+/ /g' | cut -d ' ' -f2) when: ansible_os_family == "Debian" - name: Upgraded packages (Arch based distros) pacman: update_cache: true upgrade: true when: ansible_os_family == "Archlinux" # EOF