community / community.general / 8.5.0 / module / modprobe Load or unload kernel modules Authors: David Stygstra (@stygstra), Julien Dauphant (@jdauphant), Matt Jeffery (@mattjeffery)community.general.modprobe (8.5.0) — module
Install with ansible-galaxy collection install community.general:==8.5.0
collections: - name: community.general version: 8.5.0
Load or unload kernel modules.
- name: Add the 802.1q module community.general.modprobe: name: 8021q state: present
- name: Add the dummy module community.general.modprobe: name: dummy state: present params: 'numdummies=2'
- name: Add the dummy module and make sure it is loaded after reboots community.general.modprobe: name: dummy state: present params: 'numdummies=2' persistent: present
name: description: - Name of kernel module to manage. required: true type: str state: choices: - absent - present default: present description: - Whether the module should be present or absent. type: str params: default: '' description: - Modules parameters. type: str persistent: choices: - disabled - absent - present default: disabled description: - Persistency between reboots for configured module. - This option creates files in C(/etc/modules-load.d/) and C(/etc/modprobe.d/) that make your module configuration persistent during reboots. - If V(present), adds module name to C(/etc/modules-load.d/) and params to C(/etc/modprobe.d/) so the module will be loaded on next reboot. - If V(absent), will comment out module name from C(/etc/modules-load.d/) and comment out params from C(/etc/modprobe.d/) so the module will not be loaded on next reboot. - If V(disabled), will not touch anything and leave C(/etc/modules-load.d/) and C(/etc/modprobe.d/) as it is. - Note that it is usually a better idea to rely on the automatic module loading by PCI IDs, USB IDs, DMI IDs or similar triggers encoded in the kernel modules themselves instead of configuration like this. - In fact, most modern kernel modules are prepared for automatic loading already. - B(Note:) This option works only with distributions that use C(systemd) when set to values other than V(disabled). type: str