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

This commit is contained in:
Radar231 2022-01-03 10:08:27 -05:00
parent 64f3f0734f
commit 66fc54cbbb
2 changed files with 10 additions and 28 deletions

View File

@ -4,12 +4,11 @@
This role will check for available package upgrades 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 }}
* {{ ansible_os_family }}

View File

@ -3,8 +3,6 @@
#
# This role will check for available package upgrades on the target host.
#
# This role should work on both Ubuntu and CentOS based hosts.
#
###########################################################################
#
# NOTE:
@ -12,6 +10,7 @@
# done by doing a 'gather_facts' action);
#
# {{ ansible_distribution }}
# {{ ansible_os_family }}
#
###########################################################################
# tasks file for chk_upgrades
@ -19,35 +18,19 @@
- debug: msg="Checking for package updates"
############################################################
- name: Checked for updates (Ubuntu)
- name: Checked for updates (Debian based repos)
shell:
cmd: apt list --upgradable
register: uchkout
register: dchkout
when: ansible_os_family == "Debian"
- name: Show output from update check (Ubuntu 1)
debug: msg={{ uchkout.stdout_lines }}
when: uchkout.stdout_lines is defined and ansible_os_family == "Debian"
- name: Show output from update check (deb 1)
debug: msg={{ dchkout.stdout_lines }}
when: dchkout.stdout_lines is defined and ansible_os_family == "Debian"
- name: Show output from update check (Ubuntu 2)
debug: msg={{ uchkout }}
when: uchkout.stdout_lines is undefined and ansible_os_family == "Debian"
############################################################
- name: Checked for updates (CentOS)
shell:
cmd: yum check-update --quiet
ignore_errors: true
register: cchkout
when: ansible_distribution == "CentOS"
- name: Show output from update check (CentOS 1)
debug: msg={{ cchkout.stdout_lines }}
when: cchkout.stdout_lines is defined and ansible_distribution == "CentOS"
- name: Show output from update check (CentOS 2)
debug: msg={{ cchkout }}
when: cchkout.stdout_lines is undefined and ansible_distribution == "CentOS"
- name: Show output from update check (deb 2)
debug: msg={{ dchkout }}
when: dchkout.stdout_lines is undefined and ansible_os_family == "Debian"
############################################################
- name: Checked for updates (Alpine)