feat(roles/bootloader): add role - #331
Open
markuslf wants to merge 1 commit into
Open
Conversation
Manages the kernel command line, for parameters that only take effect at boot time such as psi=1. On the Red Hat family the boot entries are written with grubby, on Debian and Ubuntu through a drop-in in /etc/default/grub.d/ followed by update-grub, so the packaged configuration files stay untouched. An option counts as present only when every boot entry carries it, and it is escaped before it goes into the comparison. A changed command line requests a reboot through schedule_reboot instead of rebooting right away, and a --check run reports what it would change without touching the host. The role deliberately does not use fedora.linux_system_roles.bootloader: that role rewrites GRUB_TIMEOUT in /etc/default/grub and every `set timeout=` in grub.cfg on each run, including the ones of the menu_auto_hide and menu_show_once blocks, and its bootloader_settings module declares supports_check_mode without ever reading module.check_mode, so a --check run rewrites the boot entries for real. Verified on Rocky 8, Rocky 9, Rocky 10, Fedora 44 and Debian 13: the check run leaves every file and boot entry byte-identical, the first run applies the options to all boot entries, the second reports no change, and removing them restores the original state.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Manages the kernel command line, for parameters that only take effect at boot time such as
psi=1. Triggered by icinga-demo, which needspsi=1for thepsi-cpu/psi-io/psi-irq/psi-memorychecks.What it does
grubby --update-kernel=ALL. Nothing ingrub.cfgis touched;grubbykeepsGRUB_CMDLINE_LINUXin/etc/default/grubin sync by itself./etc/default/grub.d/z00-lfops.cfgand runsupdate-grub.grub-mkconfigsources that directory after/etc/default/grub, so the packaged file is never edited.schedule_rebootinstead of rebooting right away.--checktouches nothing and reports what it would change.Why not fedora.linux_system_roles.bootloader
It was the first implementation, and a
--check --diffagainst a real host showed why it cannot stay:bootloader_settingsdeclaressupports_check_mode=Truebut never readsmodule.check_mode, so a dry run rewrites the boot entries for real.GRUB_TIMEOUTon every run, overwriting a value the host set on purpose.replaceongrub.cfgmatchesset timeout=.*everywhere, soset timeout="${menu_show_once_timeout}"becomes a literal and thefastbootandrecordfailtimeouts are flattened.Dropping it also removes the dependency on the Linux System Roles collection.
Verification
Run on Rocky 8, Rocky 9, Rocky 10, Fedora 44 and Debian 13, two of them with a
GRUB_TIMEOUTdiffering from the default:--check --diffgrub.cfguntouched on the Red Hat familychanged=0state: 'absent'plus rerunchanged=0on the rerunIdempotency and the check run were additionally confirmed against icinga-demo.
COMPATIBILITY.mdmarks Debian 13, RHEL 8, 9, 10 and Fedora 44 as proven; Debian 12 and the Ubuntu releases stay(x), where only the container and source-level checks exist.