Initial commit

This commit is contained in:
2026-03-08 06:55:57 -04:00
commit 63099ecf0d
9 changed files with 338 additions and 0 deletions

View 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
}

View File

@@ -0,0 +1,6 @@
#!/bin/sh
if systemctl is-active mollyguard; then
systemctl stop mollyguard
fi

View 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