Puppet Class: cassandra::system::swapoff

Defined in:
manifests/system/swapoff.pp

Overview

Parameters:

  • device (string) (defaults to: undef)

    If provided a mount resource will be created to ensure that the device is absent from /etc/fstab to permanently disable swap.

  • mount (string) (defaults to: 'swap')

    The name of the swap mount point. Ignored unless ‘device` has been set.

  • path (string) (defaults to: '/proc/swaps')

    The full path to the file to check if swap is enabled.

See Also:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'manifests/system/swapoff.pp', line 9

class cassandra::system::swapoff (
  $device  = undef,
  $mount   = 'swap',
  $path    = '/proc/swaps',
) {
  exec { 'Disable Swap':
    command => 'swapoff --all',
    onlyif  => "grep -q '^/' ${path}",
    path    => ['/bin', '/sbin', '/usr/bin', '/usr/sbin'],
  }

  if $device {
    mount { $mount:
      ensure => absent,
      device => $device,
      fstype => 'swap',
    }
  }
}