cleanup: removed centos code, cleaned up debian & ubuntu references

This commit is contained in:
Radar231 2022-01-03 10:08:27 -05:00
parent 2a2548550b
commit 8171922de7
2 changed files with 3 additions and 13 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. 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,36 +5,28 @@
# #
# The 'update_cache' role should be run before running this role. # 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 # tasks file for upgrade_pkgs
- debug: msg="Applying package updates" - debug: msg="Applying package updates"
- name: Upgraded packages (Ubuntu) - name: Upgraded packages (Debian based repos)
apt: apt:
name: "*" name: "*"
state: latest state: latest
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: Clean up the autoremove packages (Ubuntu) - name: Clean up the autoremove packages (Debian based repos)
apt: apt:
autoremove: true autoremove: true
purge: true purge: true
when: ansible_os_family == "Debian" 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 (Debina based repos)
shell: shell:
cmd: /usr/bin/apt -y --purge remove $(dpkg -l | grep "^rc " | sed 's/ \+/ /g' | cut -d ' ' -f2) cmd: /usr/bin/apt -y --purge remove $(dpkg -l | grep "^rc " | sed 's/ \+/ /g' | cut -d ' ' -f2)
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: Upgraded packages (CentOS)
yum:
name: "*"
state: latest
when: ansible_distribution == "CentOS"
- name: Upgraded packages (Alpine) - name: Upgraded packages (Alpine)
apk: apk:
upgrade: yes upgrade: yes