ansible/playbooks/check-for-nonvirt-updates.yml

62 lines
1.5 KiB
YAML
Raw Normal View History

#
2016-08-08 19:36:31 +00:00
# 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
2016-08-08 19:36:31 +00:00
# like:
#
2016-08-08 19:36:31 +00:00
# time ansible-playbook check-for-updates.yml | grep msg\": | awk -F: '{print $2}' | sort
#
2018-06-29 21:46:54 +00:00
- 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
2018-06-29 21:46:54 +00:00
- 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
2018-06-29 21:46:54 +00:00
- 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 }}"
2018-06-29 21:46:54 +00:00
- 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 }}"