Defined Type: kmod::blacklist

Defined in:
modules/kmod/manifests/blacklist.pp

Overview

SPDX-License-Identifier: Apache-2.0

Define: kmod::blacklist

Blacklist the given Linux kernel modules.

Parameters

ensure

Standard ensure parameter

modules

The list of module names to be blacklisted.

rmmod

A boolean to also remove the blacklisted module. Defaults to false for compatibility reasons

Example

kmod::blacklist { “linux44”:

modules => [ 'asn1_decoder', 'macsec' ],

}

Parameters:

  • ensure (Wmflib::Ensure) (defaults to: present)
  • modules (Array[String]) (defaults to: [])
  • rmmod (Boolean) (defaults to: false)


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'modules/kmod/manifests/blacklist.pp', line 22

define kmod::blacklist (
    Wmflib::Ensure $ensure = present,
    Array[String] $modules = [],
    Boolean $rmmod = false,
) {
    if $rmmod {
        $rmmod_args = join($modules, ' ')
        exec { "rmmod-${name}":
          command     => "/sbin/modprobe -r ${rmmod_args}",
          refreshonly => true,
        }
        $notify = [
          Exec['update-initramfs'],
          Exec["rmmod-${name}"],
        ]
    } else {
        $notify = [
          Exec['update-initramfs'],
        ]
    }
    file { "/etc/modprobe.d/blacklist-${name}.conf":
        ensure  => $ensure,
        owner   => 'root',
        group   => 'root',
        mode    => '0444',
        content => template('kmod/blacklist.conf.erb'),
        notify  => $notify,
    }
}