Handle freshness for all 3 types separately
If microcode was missing, checking the other two would be UNKN and thus not restart. But, if microcode *is* present, we want to restart for either of the other two as well. So separate into 3 distinct checks and restart if any one is changed.
This commit is contained in:
parent
c11f896a60
commit
7fe682aa60
|
@ -59,10 +59,22 @@
|
||||||
gather_facts: yes
|
gather_facts: yes
|
||||||
serial: 1
|
serial: 1
|
||||||
tasks:
|
tasks:
|
||||||
- name: check freshness
|
- name: check freshness (kernel)
|
||||||
command: /usr/sbin/needrestart -p
|
command: /usr/sbin/needrestart -p -k
|
||||||
register: freshness
|
register: freshness_kernel
|
||||||
changed_when: freshness.rc >= 1 and freshness.rc < 3
|
changed_when: freshness_kernel.rc >= 1 and freshness_kernel.rc < 3
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
- name: check freshness (libraries)
|
||||||
|
command: /usr/sbin/needrestart -p -l
|
||||||
|
register: freshness_libraries
|
||||||
|
changed_when: freshness_libraries.rc >= 1 and freshness_libraries.rc < 3
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
- name: check freshness (microcode)
|
||||||
|
command: /usr/sbin/needrestart -p -w
|
||||||
|
register: freshness_microcode
|
||||||
|
changed_when: freshness_microcode.rc >= 1 and freshness_microcode.rc < 3
|
||||||
failed_when: false
|
failed_when: false
|
||||||
|
|
||||||
- name: restart system cleanly
|
- name: restart system cleanly
|
||||||
|
@ -205,7 +217,7 @@
|
||||||
|
|
||||||
- name: reset any systemd failures
|
- name: reset any systemd failures
|
||||||
command: systemctl reset-failed
|
command: systemctl reset-failed
|
||||||
when: freshness.changed
|
when: freshness_kernel.changed or freshness_libraries.changed or freshness_microcode.changed
|
||||||
|
|
||||||
- name: wait 30 seconds for system to stabilize
|
- name: wait 30 seconds for system to stabilize
|
||||||
pause:
|
pause:
|
||||||
|
|
Loading…
Reference in New Issue