initial checkin

This commit is contained in:
Radar231 2021-07-22 23:14:57 -04:00
commit a28a22722d
2 changed files with 48 additions and 0 deletions

10
README.md Normal file
View File

@ -0,0 +1,10 @@
# Ansible Role: upgrade_pkgs
## Introduction
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.

38
tasks/main.yml Normal file
View File

@ -0,0 +1,38 @@
---
###########################################################################
#
# 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.
#
###########################################################################
# tasks file for upgrade_pkgs
- debug: msg="Applying package updates"
- name: Upgraded packages (Ubuntu)
apt:
name: "*"
state: latest
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Pop!_OS"
- name: Clean up the autoremove packages (Ubuntu)
apt:
autoremove: true
purge: true
when: ansible_distribution == "Ubuntu" or ansible_distribution == "Pop!_OS"
- name: Clean up any packages left in the 'rc' state (Ubuntu)
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"
- name: Upgraded packages (CentOS)
yum:
name: "*"
state: latest
when: ansible_distribution == "CentOS"
# EOF