Defined Type: systemd::modules_load

Defined in:
manifests/modules_load.pp

Overview

Creates a modules-load.d drop file

Examples:

load a module

systemd::modules_load { 'impi.conf':
   content => "ipmi\n",
}

override /lib/modules-load.d/myservice.conf in /etc/modules-load.d/myservice.conf

systemd::modules_load { 'myservice.conf':
   content => "# Cancel system version of the file\n",
}

Parameters:

  • filename (Systemd::Dropin) (defaults to: $name)

    The name of the modules-load.d file to create

  • ensure (Enum['present', 'absent', 'file']) (defaults to: 'file')

    Whether to drop a file or remove it

  • path (Stdlib::Absolutepath) (defaults to: '/etc/modules-load.d')

    The path to the main systemd modules-load.d directory

  • content (Optional[String[1]]) (defaults to: undef)

    The literal content to write to the file

    • Mutually exclusive with “$source“

  • source (Optional[String[1]]) (defaults to: undef)

    A “File“ resource compatible “source“

    • Mutually exclusive with “$content“

See Also:

  • modules-loadmodules-load.d(5)


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'manifests/modules_load.pp', line 36

define systemd::modules_load (
  Enum['present', 'absent', 'file'] $ensure   = 'file',
  Systemd::Dropin                   $filename = $name,
  Stdlib::Absolutepath              $path     = '/etc/modules-load.d',
  Optional[String[1]]               $content  = undef,
  Optional[String[1]]               $source   = undef,
) {
  include systemd::modules_loads

  $_tmp_file_ensure = $ensure ? {
    'present' => 'file',
    default   => $ensure,
  }

  file { "${path}/${filename}":
    ensure  => $_tmp_file_ensure,
    content => $content,
    source  => $source,
    owner   => 'root',
    group   => 'root',
    mode    => '0444',
    notify  => Class['systemd::modules_loads'],
  }
}