Compare commits

...

8 Commits

2 changed files with 11 additions and 15 deletions

View File

@ -6,5 +6,3 @@ This role will apply available package upgrades to the target host.
The 'update_cache' role should be run before running this role.
This role should work for both Ubuntu as well as CentOS based target hosts.

View File

@ -5,34 +5,32 @@
#
# The 'update_cache' role should be run before running this role.
#
# This role should work for both Ubuntu as well as CentOS based target hosts.
#
###########################################################################
# tasks file for upgrade_pkgs
- debug: msg="Applying package updates"
- name: Upgraded packages (Ubuntu)
- name: Upgraded packages (Debian based distros)
apt:
name: "*"
state: latest
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Pop!_OS"
when: ansible_os_family == "Debian"
- name: Clean up the autoremove packages (Ubuntu)
- name: Clean up the autoremove packages (Debian based distros)
apt:
autoremove: true
purge: true
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Pop!_OS"
when: ansible_os_family == "Debian"
- name: Clean up any packages left in the 'rc' state (Ubuntu)
- 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_distribution == "Ubuntu" or ansible_distribution == "Pop!_OS"
when: ansible_os_family == "Debian"
- name: Upgraded packages (CentOS)
yum:
name: "*"
state: latest
when: ansible_distribution == "CentOS"
- name: Upgraded packages (Arch based distros)
pacman:
update_cache: true
upgrade: true
when: ansible_os_family == "Archlinux"
# EOF