techno-tim / k3s-ansible

The easiest way to bootstrap a self-hosted High Availability Kubernetes cluster. A fully automated HA k3s etcd install with kube-vip, MetalLB, and more. Build. Destroy. Repeat.
https://technotim.live/posts/k3s-etcd-ansible/
Apache License 2.0
2.41k stars 1.05k forks source link

Support defining a custom reboot command #467

Closed pbolduc closed 8 months ago

pbolduc commented 8 months ago

Proposed Changes

This change adds an optional custom_reboot_command. On Diet Pi, there is no dbus installed. See Diet Pi Release Notes.

DietPi ships without dbus and with logind masked by default, as we do not see their features being used on a typical DietPi system. Instead, dbus is installed and logind unmasked on demand on certain software installs or when chosen via dietpi.txt. However, the newer systemd version since Bookworm attempts dbus > logind communication in any case when calling poweroff/reboot/halt, despite no wall message being sent, e.g. to handle shutdown inhibitors (like open SSH session being able to prevent shutdown), and throws errors if either dbus is not reachable or logind not running. Until in case dbus or logind are further tied into common system commands or features, we solved the issue by creating shell functions for poweroff/reboot/halt which call the respective systemd target directly to bypass logind (and hence dbus), but fall back to the original commands, depending on given command-line parameters.

If custom_reboot_command is defined, the reboot_command parameter will be passed to the ansible.builtin.reboot module. If custom_reboot_command is not defined, then reboot_command is omitted and the default behavior occurs.

Fixes one problem in https://github.com/techno-tim/k3s-ansible/issues/463

Checklist

pbolduc commented 8 months ago

Is this workflow failure a transient issue? Dont understand why adding optional reboot command would cause,

INFO     Pruning extra files from scenario ephemeral directory
Error: Process completed with exit code 1.
timothystewart6 commented 8 months ago

Is this workflow failure a transient issue? Dont understand why adding optional reboot command would cause,

INFO     Pruning extra files from scenario ephemeral directory
Error: Process completed with exit code 1.

Yes, this happens a lot with the ipv6 test. Going to update a few things in a PR. If this keeps happening I am leaning towards disabling that test.