role_chk_upgrades/tasks/main.yml

51 lines
1.6 KiB
YAML
Raw Normal View History

2021-07-22 23:14:54 -04:00
---
###########################################################################
#
# This role will check for available package upgrades on the target host.
#
###########################################################################
#
# 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 }}
2021-07-22 23:14:54 -04:00
#
###########################################################################
# tasks file for chk_upgrades
- debug: msg="Checking for package updates"
############################################################
- name: Checked for updates (Debian based repos)
2021-07-22 23:14:54 -04:00
shell:
cmd: apt list --upgradable
register: dchkout
when: ansible_os_family == "Debian"
2021-07-22 23:14:54 -04:00
- name: Show output from update check (deb 1)
debug: msg={{ dchkout.stdout_lines }}
when: dchkout.stdout_lines is defined and ansible_os_family == "Debian"
2021-07-22 23:14:54 -04:00
- name: Show output from update check (deb 2)
debug: msg={{ dchkout }}
when: dchkout.stdout_lines is undefined and ansible_os_family == "Debian"
2021-07-22 23:14:54 -04:00
2022-01-02 23:06:10 -05:00
############################################################
- name: Checked for updates (Alpine)
shell:
cmd: apk -U upgrade --simulate
register: achkout
when: ansible_distribution == "Alpine"
- name: Show output from update check (Alpine 1)
debug: msg={{ achkout.stdout_lines }}
when: achkout.stdout_lines is defined and ansible_distribution == "Alpine"
- name: Show output from update check (Alpine 2)
debug: msg={{ achkout }}
when: achkout.stdout_lines is undefined and ansible_distribution == "Alpine"
2021-07-22 23:14:54 -04:00
# EOF