Skip to content
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

[PR #5424/29f50337 backport][stable-6] add persistent option for modprobe #6102

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Feb 26, 2023

This is a backport of PR #5424 as merged into main (29f5033).

SUMMARY

Add persistent option as was requested in #4028

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

plugins/modules/system/modprobe.py

ADDITIONAL INFORMATION

If kernel module doesn't load after reboot(by PCI IDs, USB IDs, DMI IDs or similar triggers) you can use static files in /etc/modules-load.d to load this module. This is what I implemented. If you add option permanent and set it as true ansible will add module file which should enable module on startup. If you set permanent option as false then ansible will try to find line where you enabled this module previously and comment it out. Same works with kernel module options in /etc/modprobe.d directory.
Example:

 - name: Add the dummy module
    community.general.modprobe:
      name: dummy
      state: present
      params: 'numdummies=4'
      persistent: true

* add persistent option for modprobe

* add suggested changes + fix broken test

* change modprobe module path in tests due to rebase

* change persistent option type from bool to str with choices

* fix unused import

* add example with persistent option

* fix some minor issues after review

- move regexps compiling to __init__
- move AnsibleModule to build_module function and use this function in tests instead of AnsibleModule
- fix terminlogy issue in documentation

* fix unused-import

(cherry picked from commit 29f5033)
@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added backport feature This issue/PR relates to a feature request module module new_contributor Help guide this first time contributor plugins plugin (any type) system tests tests unit tests/unit labels Feb 26, 2023
@felixfontein felixfontein merged commit eb6ef5a into stable-6 Feb 26, 2023
@felixfontein felixfontein deleted the patchback/backports/stable-6/29f5033737a7fd86349ff3daab7d7ee7db66ad00/pr-5424 branch February 26, 2023 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request module module new_contributor Help guide this first time contributor plugins plugin (any type) system tests tests unit tests/unit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants