Puppet Class: psick::oracle::prerequisites::sysctl

Defined in:
manifests/oracle/prerequisites/sysctl.pp

Overview

This class configures the sysctl prerequisites for Oracle installation

To include and configure it do something like:


psick::oracle::prerequisites::sysctl_class: 'psick::oracle::prerequisites::sysctl'
psick::oracle::prerequisites::sysctl::template: 'psick/oracle/sysctl/my_oracle.erb'
psick::oracle::prerequisites::sysctl::options:
  shmmax = '536870912'
  shmall = '2097152'
psick::oracle::prerequisites::sysctl::use_defaults: true
psick::oracle::prerequisites::sysctl::auto_tune: true

Parameters:

  • template (Optional[String]) (defaults to: 'psick/oracle/sysctl/sysctl.erb')

    Path to the erb template of the /etc/sysctl file

  • options (Hash) (defaults to: { })

    An hash of options with values used in the template

  • use_defaults (Boolean) (defaults to: true)

    Define if to use default options or not. Note that if you set this to false the default template will fail, so you will need to provide a custom one.

  • auto_tune (Boolean) (defaults to: false)

    Define if you want to enable automatic tuning based on RAM of the default options



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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'manifests/oracle/prerequisites/sysctl.pp', line 23

class psick::oracle::prerequisites::sysctl (
  Optional[String] $template = 'psick/oracle/sysctl/sysctl.erb',
  Hash $options              = { },
  Boolean $use_defaults      = true,
  Boolean $auto_tune         = false,
) {

  if $auto_tune {
    $memsize = to_bytes($::memorysize)
    $shmmax = floor(0.5 * $memsize)
    $swapsize = $shmmax
    $memlock = $shmmax
    $pagesize = '4096'
    $shmall = floor($memsize / $pagesize)
  } else {
    $shmmax = '536870912'
    $shmall = '2097152'
  }

  $defaults = {
    'kernel.msgmnb'                 => '65536',
    'kernel.msgmax'                 => '65536',
    'kernel.shmall'                 => $shmall,
    'kernel.shmmax'                 => $shmmax,
    'kernel.sem'                    => '250 32000 100 128',
    'kernel.shmmni'                 => '4096',
    'fs.file-max'                   => '6815744',
    'fs.aio-max-nr'                 => '1048576',
    'net.ipv4.tcp_keepalive_time'   => '1800',
    'net.ipv4.tcp_keepalive_intvl'  => '30',
    'net.ipv4.tcp_keepalive_probes' => '5',
    'net.ipv4.tcp_fin_timeout'      => '30',
    'net.ipv4.ip_local_port_range'  => '9000 65500',
    'net.core.rmem_default'         => '262144',
    'net.core.rmem_max'             => '4194304',
    'net.core.wmem_default'         => '262144',
    'net.core.wmem_max'             => '1048576',
    'vm.hugetlb_shm_group'          => '1876',
    'vm.nr_hugepages'               => '1025',
    'kernel.semmsl'                 => '250',
    'kernel.semmns'                 => '3000',
    'kernel.semopm'                 => '100',
  }
  $sysctl_options = $use_defaults ? {
    true  => $defaults + $options,
    false => $options,
  }

  if $template and $template != '' {
    file { '/etc/sysctl.conf':
      ensure  => file,
      content => template($template),
    }
  }

  exec { 'sysctl -p':
    subscribe   => File['/etc/sysctl.conf'],
    command     => 'cat /etc/sysctl.conf /etc/sysctl.d/*.conf | sysctl -p -',
    refreshonly => true,
  }
}