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 will check for available package upgrades on the target host.
This role should work on both Ubuntu and CentOS based hosts.
NOTE: NOTE:
The following variable(s) must be specified in the calling playbook (usually The following variable(s) must be specified in the calling playbook (usually
done by doing a 'gather_facts' action); done by doing a 'gather_facts' action);
* {{ ansible_distribution }} * {{ 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 will check for available package upgrades on the target host.
# #
# This role should work on both Ubuntu and CentOS based hosts.
#
########################################################################### ###########################################################################
# #
# NOTE: # NOTE:
@ -12,6 +10,7 @@
# done by doing a 'gather_facts' action); # done by doing a 'gather_facts' action);
# #
# {{ ansible_distribution }} # {{ ansible_distribution }}
# {{ ansible_os_family }}
# #
########################################################################### ###########################################################################
# tasks file for chk_upgrades # tasks file for chk_upgrades
@ -19,35 +18,19 @@
- debug: msg="Checking for package updates" - debug: msg="Checking for package updates"
############################################################ ############################################################
- name: Checked for updates (Ubuntu) - name: Checked for updates (Debian based repos)
shell: shell:
cmd: apt list --upgradable cmd: apt list --upgradable
register: uchkout register: dchkout
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: Show output from update check (Ubuntu 1) - name: Show output from update check (deb 1)
debug: msg={{ uchkout.stdout_lines }} debug: msg={{ dchkout.stdout_lines }}
when: uchkout.stdout_lines is defined and ansible_os_family == "Debian" when: dchkout.stdout_lines is defined and ansible_os_family == "Debian"
- name: Show output from update check (Ubuntu 2) - name: Show output from update check (deb 2)
debug: msg={{ uchkout }} debug: msg={{ dchkout }}
when: uchkout.stdout_lines is undefined and ansible_os_family == "Debian" when: dchkout.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: Checked for updates (Alpine) - name: Checked for updates (Alpine)