Skip to content

Commit

Permalink
Add manage_kernel_parameter parameter (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
treydock authored Mar 19, 2022
1 parent 414db38 commit 6da2693
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
# Hash of config values to add to kdump.conf
# @param kernel_parameter_provider
# The provider property for the kernel_parameter defined type.
# @param manage_kernel_parameter
# Controls if kernel_parameter resource is managed
# @param grub_kdump_cfg
# Path to grub2 kdump config. Only used on Ubuntu.
class kdump (
Expand All @@ -52,6 +54,7 @@
Stdlib::AbsolutePath $config_path = '/etc/kdump.conf',
Hash $config_overrides = {},
String $kernel_parameter_provider = 'grub2',
Boolean $manage_kernel_parameter = true,
Optional[String] $grub_kdump_cfg = undef,
) {

Expand Down Expand Up @@ -104,19 +107,23 @@
}

if $enable {
kernel_parameter { 'crashkernel':
ensure => 'present',
value => $crashkernel,
target => $bootloader_config_path,
bootmode => $crashkernel_bootmode,
provider => $kernel_parameter_provider,
if $manage_kernel_parameter {
kernel_parameter { 'crashkernel':
ensure => 'present',
value => $crashkernel,
target => $bootloader_config_path,
bootmode => $crashkernel_bootmode,
provider => $kernel_parameter_provider,
}
}

if $grub_kdump_cfg {
file { $grub_kdump_cfg:
ensure => 'file',
content => "GRUB_CMDLINE_LINUX_DEFAULT=\"\$GRUB_CMDLINE_LINUX_DEFAULT crashkernel=${crashkernel}\"",
before => Kernel_parameter['crashkernel'],
}
if $manage_kernel_parameter {
File[$grub_kdump_cfg] -> Kernel_parameter['crashkernel']
}
}

Expand All @@ -142,16 +149,20 @@
}
}
} else {
kernel_parameter { 'crashkernel':
ensure => 'absent',
provider => $kernel_parameter_provider,
if $manage_kernel_parameter {
kernel_parameter { 'crashkernel':
ensure => 'absent',
provider => $kernel_parameter_provider,
}
}

if $grub_kdump_cfg {
file { $grub_kdump_cfg:
ensure => 'file',
content => "GRUB_CMDLINE_LINUX_DEFAULT=\"\$GRUB_CMDLINE_LINUX_DEFAULT\"",
before => Kernel_parameter['crashkernel'],
}
if $manage_kernel_parameter {
File[$grub_kdump_cfg] -> Kernel_parameter['crashkernel']
}
}

Expand Down

0 comments on commit 6da2693

Please sign in to comment.