-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mount: add swap management #135
base: main
Are you sure you want to change the base?
mount: add swap management #135
Conversation
c20f3b5
to
d233f95
Compare
10c0fd1
to
281f1d2
Compare
* Declare functions swapon() & swapoff(), is_swap() & reswap(). * Apply swapon/swapoff for states mounted, unmounted, remounted and absent. * Override default opts and boot when fstype=swap. * Do not honor 'fstab' when fstype=swap (fail instead). * Also fail when fstype=swap and 'path' is not 'none' ('-' for Solaris). * Update module documentation accordingly. + Replace all platform.system() calls by a variable. refactor integration tests * Improve readability/understanding of what is tested, and what OS is targeted. * Move 'swap' related test cases into dedicated file (swap.yml). * Add new test cases about swap enabling/disabling. * Extend tests to FreeBSD when possible.
281f1d2
to
e627afa
Compare
@quidame Thanks for the contribution. Should we create a separate module to manage swap rather than bloating the mount module? |
needs_info |
Yes, we should, as suggested here: #106 (comment) |
@quidame Would you be interested in raising a PR for the new module? Thanks, |
Yes, I would. But it is not written yet. Should I open a PR as a kind of placeholder waiting for this module to be written ? |
@quidame you seem to have made up your mind already to create a new module. But honestly, "mounting" swap in regards to managing an fstab entry is not vastly different from other types of filesystems. Yes to actually mount swap via Anyways. In it's current state Ansible core / posix apparently does not have any support to mount swap ... apart from hacking along with |
Sorry to restart this thread after so much time, but I think this seems reasonable as proposed in this PR and I'm inclined to merge it. What's the concern @Akasurde ? |
SUMMARY
Apply swapon / swapoff system commands onto
swap
filesystems, to reach statesmounted
(i.e. configured in fstab + swapon), unmounted (swapoff), remounted (swapoff + swapon) and absent (unconfigured in fstab + swapoff).Fixes #106
ISSUE TYPE
COMPONENT NAME
mount
ADDITIONAL INFORMATION
This now works:
and gives: