Initial commit
This commit is contained in:
13
playbooks/roles/common/scripts/kernel_func
Normal file
13
playbooks/roles/common/scripts/kernel_func
Normal file
@@ -0,0 +1,13 @@
|
||||
kernel_func () {
|
||||
machine_id=$(cat /etc/machine-id)
|
||||
current_kernel=$(uname -r)
|
||||
current_ucode=$(awk -F'[[:space:]]*:[[:space:]]*' '/microcode/ {print $2}' /proc/cpuinfo | uniq)
|
||||
[[ -f /run/next_kernel ]] && next_kernel="$(sudo cat /run/next_kernel)"
|
||||
next_ucode=$(iucode_tool -lqS /lib/firmware/intel-ucode/ | grep -Po 'rev 0x\d+' | tr -d '[rev ]' | tail -1)
|
||||
if [[ "${current_kernel}" == ${next_kernel} ]] && [[ "${current_ucode}" == ${next_ucode} ]] || [[ -z "${next_kernel}" ]]
|
||||
then
|
||||
print -P "[%F{#00ff00}OK%f]"
|
||||
else
|
||||
print -P "[%F{yellow}needs reboot%f]"
|
||||
fi
|
||||
}
|
||||
6
playbooks/roles/common/scripts/stop_mollyguard
Normal file
6
playbooks/roles/common/scripts/stop_mollyguard
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
if systemctl is-active mollyguard; then
|
||||
systemctl stop mollyguard
|
||||
fi
|
||||
|
||||
13
playbooks/roles/common/tasks/reboot.yml
Normal file
13
playbooks/roles/common/tasks/reboot.yml
Normal file
@@ -0,0 +1,13 @@
|
||||
- name: Stop mollyguard if active
|
||||
ansible.builtin.script: scripts/stop_mollyguard
|
||||
register: mg
|
||||
- name: Determine if a reboot is necessary
|
||||
ansible.builtin.command:
|
||||
cmd: ~/bin/needs_reboot
|
||||
register: needs_reboot
|
||||
- name: Conditionally reboot
|
||||
ansible.builtin.reboot:
|
||||
when:
|
||||
- inventory_hostname not in group['controller']
|
||||
- mgc succeeded
|
||||
- needs_reboot succeeded
|
||||
Reference in New Issue
Block a user