Puppet Class: kubeinstall::system::swap

Defined in:
manifests/system/swap.pp

Summary

Disable swap on the system

Overview

Disable swap on the system

Examples:

include kubeinstall::system::swap


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

class kubeinstall::system::swap {
  # proceed  only if swap exists
  if $facts['memory'] and $facts['memory']['swap'] {
    exec { 'swapoff -a':
      path => '/usr/sbin:/sbin:/usr/bin:/bin',
    }

    $facts['partitions'].each |$part, $opts| {
      if $opts['filesystem'] == 'swap' {
        # remove from fstab
        mount { "swap-${part}":
          ensure => 'absent',
          name   => 'swap',
          device => $part,
          fstype => 'swap',
        }
      }
    }
  }
}