diff --git a/playbooks/check-for-nonvirt-updates.yml b/playbooks/check-for-nonvirt-updates.yml index bf59009b4f..32d05f953f 100644 --- a/playbooks/check-for-nonvirt-updates.yml +++ b/playbooks/check-for-nonvirt-updates.yml @@ -8,25 +8,54 @@ # time ansible-playbook check-for-updates.yml | grep msg\": | awk -F: '{print $2}' | sort # -- name: check for updates - hosts: all - gather_facts: true - user: root +- 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 - when: ansible_distribution_major_version|int < 22 and ansible_virtualization_role == 'host' + + - 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 - when: ansible_distribution_major_version|int > 21 and ansible_virtualization_role == 'host' - - - debug: msg="{{ inventory_hostname}} {{ yumoutput.results|length }}" - when: yumoutput is defined and yumoutput.results|length > 0 - debug: msg="{{ inventory_hostname}} {{ dnfoutput.results|length }}" - when: dnfoutput is defined and dnfoutput.results|length > 0 diff --git a/playbooks/check-for-updates.yml b/playbooks/check-for-updates.yml index ec828497de..5349748a85 100644 --- a/playbooks/check-for-updates.yml +++ b/playbooks/check-for-updates.yml @@ -9,24 +9,35 @@ # - name: check for updates - hosts: all - gather_facts: true - user: root + hosts: distro_RedHat:distro_CentOS:!*.app.os.fedoraproject.org:!*.app.os.stg.fedoraproject.org + gather_facts: false tasks: - name: check for updates (yum) yum: list=updates update_cache=true register: yumoutput - when: ansible_distribution_major_version|int < 22 + + - debug: msg="{{ inventory_hostname}} {{ yumoutput.results|length }}" + when: yumoutput.results|length > 0 + +- name: check for updates + hosts: distro_Fedora:!*.app.os.fedoraproject.org:!*.app.os.stg.fedoraproject.org + gather_facts: false + + tasks: + +# +# We use the command module here because the real module can't expire +# + + - name: make dnf recheck for new metadata from repos + command: dnf clean expire-cache + warn: False - name: check for updates (dnf) dnf: list=updates register: dnfoutput - when: ansible_distribution_major_version|int > 21 - - - debug: msg="{{ inventory_hostname}} {{ yumoutput.results|length }}" - when: yumoutput is defined and yumoutput.results|length > 0 - debug: msg="{{ inventory_hostname}} {{ dnfoutput.results|length }}" - when: dnfoutput is defined and dnfoutput.results|length > 0 + when: dnfoutput.results|length > 0