Repository navigation
system_settings: write sysctl settings to /etc/sysctl.d - #102
Merged
Merged
Conversation
The sysctl task relied on the ansible.posix.sysctl default of /etc/sysctl.conf. procps reads that file last, after every sysctl.d directory, so these values silently overrode drop-ins that other software ships for itself, regardless of the intended precedence. Write them to /etc/sysctl.d/50-incus-deploy.conf instead and remove any copies an earlier run left in /etc/sysctl.conf. The settings list moves to vars/ so both tasks stay in sync. Signed-off-by: Stephan Peijnik-Steinwender <speijnik@eoscloud.io>
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.
The
system_settingsrole calledansible.posix.sysctlwithoutsysctl_file, so all eleven settings were written to the module's default of/etc/sysctl.conf.procps reads
/etc/sysctl.conflast, after everysysctl.ddirectory, so anything this role sets silently overrides drop-ins that other software ships for itself — regardless of the precedence those files were numbered for.We hit this on hyperconverged hosts running Incus alongside Ceph. cephadm installs
/etc/sysctl.d/90-ceph-<fsid>-osd.confasking forfs.aio-max-nr = 2097152, and then its ownsysctl --systemre-read/etc/sysctl.conflast and put the value back to this role's524288. Incus' own packaged/usr/lib/sysctl.d/50-incus.confasks for16777216and was overridden the same way, as was the distro's55-map-count.confforvm.max_map_count.This writes the settings to
/etc/sysctl.d/50-incus-deploy.confinstead, so they participate in the normalsysctl.dordering like every other package's defaults. The50-prefix keeps them below anything an administrator or another package numbers higher.Because existing deployments already have these keys in
/etc/sysctl.conf, where they would keep winning forever, a second task removes them from that file. It usesreload: false, since re-reading/etc/sysctl.confafter the removal would only re-apply whatever unrelated content that file still holds and cannot restore drop-in values anyway; the first task's own reload already applies the intended values, and the rest resolves at next boot.The settings list moves to
vars/main.ymlso the apply and cleanup tasks cannot drift apart.No behaviour change is intended for hosts that do not have competing drop-ins: the same eleven values are still applied, just from a file that respects
sysctl.dprecedence.