ansible/playbooks/check-for-nonvirt-updates.yml
2018-06-29 21:46:54 +00:00

61 lines
1.5 KiB
YAML

#
# simple playbook to check all hosts and see how many updates they have pending.
# It could be a lot faster if we didn't gather facts, but we need that for yum vs dnf checking
#
# If you want a pretty sorted list, you need to post process the output here with something
# like:
#
# time ansible-playbook check-for-updates.yml | grep msg\": | awk -F: '{print $2}' | sort
#
- name: check for updates (EL)
hosts: virt_host:&distro_RedHat
gather_facts: false
tasks:
- name: check for updates (yum)
yum: list=updates update_cache=true
register: yumoutput
- debug: msg="{{ inventory_hostname}} {{ yumoutput.results|length }}"
- name: check for updates (Fedora)
hosts: virt_host:&distro_Fedora
gather_facts: false
tasks:
- name: check for updates (dnf)
dnf: list=updates
register: dnfoutput
- debug: msg="{{ inventory_hostname}} {{ dnfoutput.results|length }}"
#
# For some reason ansible detects aarch64/armv7 hosts as virt type "NA"
#
- name: check for updates (aarch64/armv7) EL
hosts: virt_NA:&distro_RedHat
gather_facts: false
tasks:
- name: check for updates (yum)
yum: list=updates update_cache=true
register: yumoutput
- debug: msg="{{ inventory_hostname}} {{ yumoutput.results|length }}"
- name: check for updates (aarch64/armv7) Fedora
hosts: virt_NA:&distro_Fedora
gather_facts: false
tasks:
- name: check for updates (dnf)
dnf: list=updates
register: dnfoutput
- debug: msg="{{ inventory_hostname}} {{ dnfoutput.results|length }}"